Have a look at this, it did help me to get rid of all the almost-
simular controller files:
http://groups.google.com/group/cake-php/browse_thread/thread/7638b690ae0545ff


On 10 mrt, 15:57, sleepy1038 <[EMAIL PROTECTED]> wrote:
> I think I may try implementing some logic in AppController. I will let
> you know how it turns out.
>
> Thank You
>
> On Mar 10, 9:36 am, djiize <[EMAIL PROTECTED]> wrote:
>
> > you can load a Model in a component
> > see App::import('Model', 'ModelName')
>
> > but it's not very MVC compliant, so if you can avoid that... ;)
>
> > Maybe you could do your business in AppController, or better in a
> > behavior (or many) ?
>
> > On 10 mar, 13:58, sleepy1038 <[EMAIL PROTECTED]> wrote:
>
> > > Could I use a component instead, since a lot of the logic that is
> > > being duplicated is business logic? If so, how do I use Model classes
> > > in a component? According to the manual, there is no guarantee that
> > > model instances will be created at the time my component attempts to
> > > use them.
>
> > > Thanks,
>
> > > Mike
>
> > > On Mar 10, 2:28 am, Adam Royle <[EMAIL PROTECTED]> wrote:> You have three 
> > > options:
>
> > > > - put generic code in app_model.php
> > > > - use model inheritance, eg. class MyModel extends MyBaseModel, class
> > > > MyBaseModel extends AppModel
> > > > - write a model behaviour (not unlike multiple inheritance)
>
> > > > Cheers,
> > > > Adam
>
> > > > On Mar 10, 4:04 pm, sleepy1038 <[EMAIL PROTECTED]> wrote:
>
> > > > > In my application, I will have the same problem if I put the bulk of
> > > > > the code in the models. I have as many models as I do controllers. How
> > > > > should I handle this?
>
> > > > > Thanks
>
> > > > > On Mar 9, 10:31 pm, mbavio <[EMAIL PROTECTED]> wrote:
>
> > > > > > The essential Fat Models, Skinny Controllers:
>
> > > > > > "Write big and long models, and short controllers"
>
> > > > > > DRY itself.
>
> > > > > > Cheers,
> > > > > > Martin B
>
> > > > > > On Mar 9, 4:52 pm, sleepy1038 <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hello,
>
> > > > > > > I've recently implemented a content management system using Cake, 
> > > > > > > and
> > > > > > > am running into a design issue. I have many different types of 
> > > > > > > posts
> > > > > > > (articles, books, etc.). All these posts must be associated to 
> > > > > > > tags. I
> > > > > > > implemented a general posts table, and associated the tags to 
> > > > > > > this. I
> > > > > > > then implemented each type of post as belonging to a content post.
>
> > > > > > > The problem is, I now have many controllers. Each post type has 
> > > > > > > its
> > > > > > > own controller, although aside from differing fields they pretty 
> > > > > > > much
> > > > > > > have the same controller logic. The only thing that really 
> > > > > > > differs in
> > > > > > > each controller code is the name of the controller instance. 
> > > > > > > Whenever
> > > > > > > I need to make an update, I have to essentially copy and paste 
> > > > > > > into 10
> > > > > > > different controllers.
>
> > > > > > > My questions is, how do I consolidate this logic into one 
> > > > > > > location. I
> > > > > > > thought about using a component, put b/c Cake uses lazy loading I
> > > > > > > don't believe the model classes are available in a component. Am I
> > > > > > > wrong about this? Is there a way around this? Also, is there any 
> > > > > > > way
> > > > > > > to consolidate the many views associated with the controllers? Any
> > > > > > > help would be greatly appreciated.
>
> > > > > > > Thank You
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to