Thursday, February 5, 2015

Re: CakePHP 2.6 Controllers with New Folder Structure

Please always reply to the group - I seldom checks my mailbox :)

I looked in the CakePHP book and it did not show any examples of passing all the different paths for different classes, so lets try this:

App::build(array('Model' => array(APP . 'Model' . DS, APP . 'Model' . DS . 'Customers' . DS, APP . 'Model' . DS. 'Products' . DS)));
App::build(array('Controller' => array(APP . 'Controller' . DS, APP. 'Controller' . DS. 'Customers' . DS, APP . 'Controller' . DS . 'Products' . DS)));

and so on. That should set it up with the full path as the book says it needs. Please try and report back :)
Enjoy, John


On 5 February 2015 at 21:15, Shiv Modi <shiv...@gmail.com> wrote:
Hi John,

I tried that one as well but not getting desired results.

Regards,
Shiv

On Thursday, 5 February 2015 20:05:01 UTC+2, John Andersen wrote:
You are trying to create an array that contains two entries with the same index - only the last entry with the same index will be used.

Change your array to look like this - showing only the Model entry as an example:
'Model' => array('/Model/', '/Model/Customers/', '/Model/Products/'),

Do the same for Controller and View entries.

Enjoy, John

On Thursday, 5 February 2015 12:24:41 UTC+2, Shiv Modi wrote:
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: