Thursday, January 8, 2015

Re: belongsTo custom condition not working

Hi Matt

Before I even consider the complexity that you have designed, I would like to know why you are not just simplifying it. Your person_follows table usage for relationships between people and followers and organizations and followers just makes it so harder to work with it. Do it the CakePHP way and simplify it.

For the people and followers you only need the persons table and a followers_persons table.
For the organization and followers you only need the organizations, persons and a followers_organizations table.

Simplified definitions:
"persons"
id
name

"followers_persons"
id
follower_id (which in the model will point to persons.id)
person_id

"organizations"
id
name

"followers_organizations"
id
follower_id (which in the model will point to persons.id)
organization_id

The above is the CakePHP way and will make your life easier. Before starting thinking on how CakePHP should work, make sure you have designed your database models for the situations you wish it to cover.

Do you have the option to redesign your database on the above?

Enjoy, John

--
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: