Monday, October 26, 2015

Re: New CakePHP ORM to CakePHP 2.x

I don't get your problem guys. :) Add the new ORM via composer.

Just create the folders inside your 2.x app:
  • app/Model/Table
  • app/Model/Entity
Make sure your autoloader is finding the classes based on their namespace and put your tables and entities in there just as you would do it in Cake3. Then use the TableRegistry instead of the ClassRegistry to get your table objects. Just the fact that Cake2 is not using newer php language features doesn't mean you can't use them. You can create and use traits within your app as well to make getting tables more easy for example.

BUT: If you're after a magic "convert all and everything" to the new ORM, this is not going to happen, you'll have to do it by hand.

The way we do it is to slowly migrate what we need, when we need it. So we'll slowly replace the old with the new ORM, they can co-exist. This way we get the fancy new ORM but can slowly migrate our app as we go.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: