I just want to clarify that I'm not promoting the model = data mentality.  I
don't particularly love full ORM solutions, so I tend to use a data mapper
that handles extracting data from my model and passing it to the data access
object (whether that's a relational database, a no-SQL style database, or a
web service, etc).

That said, there's nothing wrong with having a base model class that handles
common model functionality (whatever that means in your particular
situation).

CM

  <http://cmorrell.com/> *Chris Morrell*  Web: http://cmorrell.com  Twitter:
@inxilpro <http://twitter.com/inxilpro>


On Sat, Mar 27, 2010 at 11:27 AM, jsuggs <[email protected]> wrote:

>
>
> Chris Morrell-2 wrote:
> >
> > Right now I treat my models as resources with a special exception for the
> > user model which is both a resource and a role.  Then I actually make the
> > models responsible for managing their own ACL permissions, both setting
> > them
> > up and querying them.  To facilitate that, I have a base model class that
> > does a few things.  First it has a way to inject an ACL instance into the
> > model as well as a way to pass an ACL instance as the default ACL for all
> > models (which I do in my bootstrap).  Second it automatically adds itself
> > to
> > that ACL (with the resource id model:moduleName.modelName).  Finally, I
> > have
> > an *_initAcl()* method which is called when my model is instantiated
> which
> > adds the appropriate rules to the ACL if they don't already exist.
> > Whenever
> > my model is doing something that is access-controlled I check the ACL
> > right
> > then.
> Hi Chris, thanks for that.  Added you to my list of blogs to follow.  I'll
> try to give some feedback here in the next few days.  Just as a background,
> I'm forging ahead with Doctrine 2 along with the idea that the actual model
> classes shouldn't be extending any base classes (related to data access),
> but I think I agree that they can/should be able to extend/interact with
> ACL
> related classes (where appropriate).
>
> Right now, I have most all of my model interaction occurring thought a
> service layer that requires the Doctrine EntityManager (DI), so that when I
> operate on my "models" I'm just passing the (more or less) plain old PHP
> objects around.  I'm still very early in the development/prototyping stage,
> so there are still lots of design decisions left to be made.
> --
> View this message in context:
> http://n4.nabble.com/Models-and-Services-ACL-Where-and-How-tp1692595p1693469.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to