> On Sat, Sep 26, 2009 at 9:38 AM, lorenx <lorenx@gmail.com> wrote:
>>
>> sorry...
>>
>> and if i need something like this
>>
>> 'contain' => array(
>> 'DpageStruct' => array(
>> 'DpageStructField' => array(
>> 'DpageField' => array(
>> 'Language'
>> ),
>> 'HtmlInputType',
>> 'order' => $this->OtherModel->order
>> )
>> )
>> )
>>
>> is that the correct way to refer to the OtherModel property or not...
>
> Yes and no. You can refer to it as $this->OtherModel->order IF your
> model has a class var $order. But the order option shouldn't be inside
> your contain array, anyway.
>
> $this->YourModel->find(
> 'all',
> array(
> 'order' => $this->TheModel->order,
> 'contain' => $this->TheModel->contain
> )
> );
>
> Besides, even if you could put the 'order' option inside the 'contain'
> array, it still wouldn't work if you also want to use a class var
> $contain. ie, it wouldn't work because you can't do (in the model)
>
> var $order = array(...);
>
> var $contain = array(
> 'DpageStruct' => array(
> 'DpageStructField' => array(
> 'DpageField' => array(
> 'Language'
> ),
> 'HtmlInputType',
> 'order' => $this->order
> )
> )
> );
>
> That would trigger a fatal error because you're defining a class
> variable yet using the keyword $this, which is inappropriate (there's
> no instance of the model at this point).
>
Wait. Cancel that. You can, in fact, use 'order' within the 'contain'
array. But my last comment stands. You couldn't refer to a class var
$order while defining the class var $contain. Unless you think you'll
need to refer to $this->TheModel->order somewhere, you're probably
better off not declaring it and just spell out the order in the
declaration for $contain because you'd be defining it twice. ie:
var $order = array('foo' => 'bar');
var $contain = array(
'DpageStruct' => array(
'DpageStructField' => array(
'DpageField' => array(
'Language'
),
'HtmlInputType',
'order' => array('foo' => 'bar')
)
)
);
That doesn't seem very efficient.
Does that make sense?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment