Subclassing one's own Controllers
I'm a reasonably-experienced cake developer (several shipping apps over a few years), and I've now got a project with a well-developed Controller class that now requires several variations, all of which would still rely on the same model. My general OOP instinct is to subclass the controller class, but when I try that in cake (1.3) I get a class-not-found error. I've seen some discussion of using behaviors for this, but that seems contrary to this setup, where the main controller has a model, plenty of views, methods, etc. Advice? thanks -eric -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Subclassing one's own Controllers
I'm a reasonably-experienced cake developer (several shipping apps over a few years), and I've now got a project with a well-developed Controller class that now requires several variations, all of which would still rely on the same model. My general OOP instinct is to subclass the controller class, but when I try that in cake (1.3) I get a class-not-found error. I've seen some discussion of using behaviors for this, but that seems contrary to this setup, where the main controller has a model, plenty of views, methods, etc. if you are planning on sub classing the controller, why not write a component that all controllers use? move your core functions into the component and then set up other controllers that handle the variations and use that component. /2pence Advice? thanks -eric -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Subclassing one's own Controllers
A component with a set of associated Models and whatnot? -e On Aug 18, 3:04 pm, mi...@brightstorm.co.uk wrote: I'm a reasonably-experienced cake developer (several shipping apps over a few years), and I've now got a project with a well-developed Controller class that now requires several variations, all of which would still rely on the same model. My general OOP instinct is to subclass the controller class, but when I try that in cake (1.3) I get a class-not-found error. I've seen some discussion of using behaviors for this, but that seems contrary to this setup, where the main controller has a model, plenty of views, methods, etc. if you are planning on sub classing the controller, why not write a component that all controllers use? move your core functions into the component and then set up other controllers that handle the variations and use that component. /2pence Advice? thanks -eric -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Subclassing one's own Controllers
Or you could write most of your functionality in a plugin which allows you to tie models to your controllers. Using a component just deals with controller actions iirc Mike Karthauser Brightstorm limited Tel: 07939252144 On 18 Aug 2011, at 14:10, Eric Blanpied sparkal...@gmail.com wrote: A component with a set of associated Models and whatnot? -e On Aug 18, 3:04 pm, mi...@brightstorm.co.uk wrote: I'm a reasonably-experienced cake developer (several shipping apps over a few years), and I've now got a project with a well-developed Controller class that now requires several variations, all of which would still rely on the same model. My general OOP instinct is to subclass the controller class, but when I try that in cake (1.3) I get a class-not-found error. I've seen some discussion of using behaviors for this, but that seems contrary to this setup, where the main controller has a model, plenty of views, methods, etc. if you are planning on sub classing the controller, why not write a component that all controllers use? move your core functions into the component and then set up other controllers that handle the variations and use that component. /2pence Advice? thanks -eric -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Subclassing one's own Controllers
I think you can find an example in Practical CakePHP Projects book On Thu, Aug 18, 2011 at 11:14 AM, Eric Blanpied sparkal...@gmail.comwrote: I'm a reasonably-experienced cake developer (several shipping apps over a few years), and I've now got a project with a well-developed Controller class that now requires several variations, all of which would still rely on the same model. My general OOP instinct is to subclass the controller class, but when I try that in cake (1.3) I get a class-not-found error. I've seen some discussion of using behaviors for this, but that seems contrary to this setup, where the main controller has a model, plenty of views, methods, etc. Advice? thanks -eric -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php