Where to put the Model code in php

2

I have some tables in my db between them are

post_has_categoria
post
categoria

In My Models I have the Category.php and the Contest.php where should sql be responsible for post_has_category?

    
asked by anonymous 20.03.2017 / 05:10

1 answer

3

Given the assumption that this sql / method would check "there is category in post?", this same sql / method would be in the Post class following the IE (information expert) standard - who has / knows the information it should perform the task. In this case, only the Post class knows if it has category.

    
20.03.2017 / 12:29