Search code examples
cakephpmodelconflict

cakePHP: having model named 'Page'


I'm going to create models named 'Book' and 'Page' which are related. How can I avoid conflicts between my 'Pages' and built-in 'Pages' of cakePHP inside View folder?

I should notice that I need built-in Pages of cakePHP to display some static pages such as contact us


Solution

  • You can just rename the default PagesController to something else like StaticPagesController (and related changes to routes and view folder). Then make a new PagesController & Page model.

    You can even the existing PagesController if you wanted to by removing public $uses = array(); from it. But since your book pages and static page rendering are unrelated it's best not to do so.