How to use a session var inside $hasMany condition ?

2012-03-09 Thread heohni
Hi, I want to use such a association: var $hasMany = array( 'Comment' = array( 'className' = 'Comment', 'foreignKey' = 'user_id', 'conditions' = array('Comment.status' = '1'), ) ); can I somehow use my current session value for the condition? Like 'conditions' = array('UEB_FKID_SPR_ID' =

Re: How to use a session var inside $hasMany condition ?

2012-03-09 Thread Rodrigo Rodrigues Moyle
Add the ContainableBehavior to your AppModel class, and when using find: $model-find('all', array( 'contain' = array( 'Comment' = array( 'conditions' = array( 'Comment.UEB_FKID_SPR_ID' = CakeSession::read('Config.languageID' ) ) ) ))) -- Our newest site for the community: CakePHP Video

Re: How to use a session var inside $hasMany condition ?

2012-03-09 Thread heohni
Hi, I tried this, but with no effect, no error messae, but the select returns all found data without the contain conditions. Please help me $results = ClassRegistry::init('Eigenschaftsarten')-find('all', array( 'contain' = array( 'Uebersetzungen' = array( 'fields' = 'UEB_TEXT,

Re: How to use a session var inside $hasMany condition ?

2012-03-09 Thread lowpass
On Fri, Mar 9, 2012 at 10:38 AM, heohni heidi.anselstet...@consultingteam.de wrote: var $hasMany = array( 'Uebersetzungen' = array( 'className' = 'Uebersetzungen', 'foreignKey' = 'UEB_NUMMER',      'conditions' = array('UEB_FKID_SPR_ID' = 1) = this is the place I wanted to use my session

Re: How to use a session var inside $hasMany condition ?

2012-03-09 Thread heohni
Hi!, did you just read what my answer was? I tried, but the find statement simply ignores my condition with the contain. Do you know why or what I am doing wrong? Am Freitag, 9. März 2012 14:30:49 UTC+1 schrieb heohni: Hi, I want to use such a association: var $hasMany = array( 'Comment'