Author Topic: Model Plugins  (Read 2716 times)

Celeb

  • Guest
Model Plugins
« on: December 21, 2007, 05:00:55 pm »
I've started a little project so I have an excuse (and the ability) to play around with TMVC. :)

It's about creating and maintaining one ore more Warhammer (the tabletop) armies. If you want to know more about the project I'll gladly go into more detail but for my question that's not really necessary.

As far as I've come to know TMVC all custom plugins are available for the controllers only, right?
Do you plan to add some way so you can define plugins for Models? I'm thinking of some kind of caching plugin for example to reduce database traffic.
I know you can cache using Smarty but that's not really the same IMO. And it's only an example :) The very existance of the "proprietary" database plugin shows that plugins for Models are useful.

mohrt

  • Administrator
  • Sr. Member
  • *****
  • Posts: 275
    • View Profile
Re: Model Plugins
« Reply #1 on: December 21, 2007, 05:18:31 pm »
There is no supplied way for models to access plugins. To be honest, database caching should be handled by the database layer (PDO, or other.) You can extend the TMVC_PDO class and implement your caching there.

Also, as a last resort, you can grab an instance of the tmvc object from within a model with $obj = tmvc::instance(); and access the controller from there.
« Last Edit: December 21, 2007, 05:26:04 pm by mohrt »

Celeb

  • Guest
Re: Model Plugins
« Reply #2 on: December 21, 2007, 06:07:09 pm »
Well .. I'll think about how I handle my data in the Model, so I maybe don't need caching after all. It was just a thought :)

Doesn't the component that provides caching need some information about the data to efficiently cache it?