2. associations handle joins automatically - so when you get the value of one model you also get its associated data back as well. You can also save associated data using the reverse (set associated data in the model and then save the model and its associated data). If you don't like the way a join is happening for a particular query you can dynamically bind and unbind models: http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#creating-and-destroying-associations-on-the-fly
You can also control what is returned by using the Containable behavior: http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
Finally, if you need to craft your own joins, the find method accepts an key in its options array for a joins array where you can define complex joins.
3. CakePHP is flexible - and it is not difficult to build a cakephp model. Follow the conventions and be happy.
On Thu, Nov 15, 2012 at 10:45 PM, Andre Sutarko <asutarko1979@gmail.com> wrote:
Hello, Cakephp team. I'm new member of your Cakephp Groups. I have trouble of using cakephp framework. I'm using Cakephp 2.2.3. I have some question about this cakephp as
Your cakephp build so well but build model for joining some table mistake and difficult
- Why cakephp model always use id of table as primary key? Why don't cakephp model use others as primary key?
- using method of cakephp model (hasOne, hasMany, Belongto etc) is difficult. itable t won't suitable if we will join some table. if cakephp model can join some table. please you give sample.
- Please cakephp is be build flexible. I will build cakephp model difficult.
Trims
Andre --
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment