ok, i follow your advice and i stop here.

thank a lot, really!


On Sep 26, 4:45 pm, brian <bally.z...@gmail.com> wrote:
> On Sat, Sep 26, 2009 at 10:36 AM, lorenx <lor...@gmail.com> wrote:
>
> > ok, just to make sure we understand each other :)
>
> > the following is not correct:
>
> > class ModelA extends AppModel {
> >        var $belongsTo = array('ModelB');
>
> >        // i recently learn that this will raise "auto-recursive"
> > automatically, marvellous!
> >        var $actsAs = array('Containable');
>
> >        var $contain = array(
> >                'ModelB' => array(
> >                        'order' => $nonexistentReference->ModelB->order
> >                )
> >        );
> > }
>
> > class ModelB extends AppModel {
> >        var $hasMany = array('ModelA');
>
> >        var $order = 'ModelB.modelb_column DESC';
> > }
>
> > i cannot centralize, in respective models, both ModelA contain and
> > ModelB order properties, cause it is not possible for models to have
> > references to each other...
> > if i decide to centralize ModelA contain i need to explicit define the
> > (external) order string:
>
> > class ModelA extends AppModel {
> >        var $belongsTo = array('ModelB');
>
> >        // i recently learn that this will raise "recursive" automatically ;)
> >        var $actsAs = array('Containable');
>
> >        var $contain = array(
> >                'ModelB' => array(
> >                        'order' => 'ModelB.column DESC'
> >                )
> >        );
> > }
>
> > class ModelB extends AppModel {
> >        var $hasMany = array('ModelA');
> > }
>
> > am i right?
> > (if so, i allow myselft to say that this is not awesome, cause i now
> > have a ModelB property set in the ModelA... correct me if i am wrong)
>
> > thanks again!
>
> Yes, that's correct. But it's due to the limitations of OO
> programming, not Cake. In the class variable declarations, it's not
> possible to refer to other properties of the model because there's no
> instance of it yet.
>
> I suppose it's MAYBE possible to do:
>
> var $contain = array(
>            'ModelB' => array(
>                            'order' => ClassRegistry::init('ModelB')->order
>            )
> );
>
> ... but I'm not sure I even want to know. That looks dreadful.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to