initialize() will be called automatically when you retrieve the model using
Controller::get(Global)Model().

It's fairly interesting that you come up with this - it is exactly what
we've been discussing here a couple of days ago.
This is my personal opinion (but some people share this point of view):
Models are containers for your business logic. There has to be some sort of
data exchange with the outer framework, and I think you may very well access
the User, do other stuff with the Context and Controller or whatever from
inside the Model. If you want maximum portability of your business logic,
you should place it in an external class and use a Model as a wrapper
interface to provide the "library's" functionality to the framework.

I don't think we should add this path to include_path by default. That's
what config.php is there for, after all - customizing stuff like this on a
per-project basis

- David 


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of [EMAIL PROTECTED]
> Sent: Monday, August 01, 2005 7:16 PM
> To: [email protected]
> Subject: [agavi-dev] custom module initialization & include path
> 
> Hi,
> 
> 1. I'd like to create module by extending Module class - can I make
> somehow function initialize to be executed automaticaly ? I'd like to
> have a code like that:
> 
> class MyModel extends Model
> {
>     public function initialize($context)
>     {
>         return parent::initialize($context);
>     }
> 
>     public function dump()
>     {
>         var_dump($this->getContext());
>     }
> }
> 
> Do you think I should avoid Model accessing some other classess (like
> User) directly ? Sometimes it comes handy, but I think that reusability
> of module suffers because of that.
> 
> 2. Should we extend include path for %AG_WEBAPP_DIR%/lib by default ?
> Wombert's tutorial on how to integrate Agavi & Propel won't work, unless
> user will set it.
> 
> _______________________________________________
> agavi-dev mailing list
> [email protected]
> http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev



_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev

Reply via email to