Class Thing extends AppModel {
var $hasAndBelongsToMany = array(
'Item' => array(),
);
function __construct($id = false, $table = null, $ds = null) {
$this->hasAndBelongsToMany['Item']['conditions'] =
Configure::read('site_id');
parent::__construct($id, $table, $ds);
}
}
On Mon, Oct 13, 2008 at 11:11 AM, Ryan <[EMAIL PROTECTED]> wrote:
>
> Thanks for the replies...
>
> francky: Using beforeFind() or a condition in the query array is what
> I am doing now, and what I am trying to avoid.
>
> Dardo: Could you give me an example of using the model constructor, or
> point me to a resource?
>
>
> On Oct 12, 7:17 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>> Or use the model constructor...
>>
>> On Sun, Oct 12, 2008 at 5:08 PM, francky06l <[EMAIL PROTECTED]> wrote:
>>
>> > You can't use a function in a member variable. However you can
>> > probably do it in a beforeFind (even just adding the condition in the
>> > query array)..
>>
>> > On Oct 12, 7:43 pm, Ryan <[EMAIL PROTECTED]> wrote:
>> >> Cake is not liking:
>>
>> >> var $hasAndBelongsToMany = array(
>> >> 'Item' => array(
>> >> 'conditions' => array('`Item`.`site_id`' =>
>> >> Configure::read('site_id'))
>> >> )
>> >> );
>>
>> >> But it's ok with:
>>
>> >> var $hasAndBelongsToMany = array(
>> >> 'Item' => array(
>> >> 'conditions' => array('`Item`.`site_id`' => 1)
>> >> )
>> >> );
>>
>> >> How can I use the value of Configure::read('site_id') in my models?
>>
>> >> Thanks!
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---