Thursday, February 5, 2015

CakePHP 2.6 Controllers with New Folder Structure

Hi,

I am using CakePHP 2.6 and want to make two sub-folders, Products and Customers in app/Controller , Model and View folders. So that I can categories my product and customer controllers for proper understanding. To implement and access the same I done some changes in bootstrap as follow:

App::build(array(
      'Model'                     => array('/Model/', '/Model/Products/'),
     
      'Controller'                => array('/Controller/', '/Controller/Products/'),
     
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It worked well.

But when i tried to add the entries for Customers controllers also it will get overwritten by the other one: 

App::build(array(
      'Model'                     => array('/Model/', '/Model/Customers/'),
      'Model'                     => array('/Model/', '/Model/Products/'),
      'Controller'                => array('/Controller/', '/Controller/Customers/'),
      'Controller'                => array('/Controller/', '/Controller/Products/'),
      'View'                      => array('/View/', '/View/Customers/'),
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It's not working proper. Only Products section is working fine not Customers one because keys are same and it's getting overwritten. How I can fix this problem?

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