CakeSession should be used as static, like CakeSession::read(), ::write(),
and so on, like below
App::import('Model', 'CakeSession');
CakeSession::yourmethod();
--
Lep pozdrav, Tilen Majerle
http://majerle.eu
2012/6/14 Umashankar Pandey <[email protected]>
> App::import('Model', 'CakeSession');
> $session = new CakeSession();
> i done and check it.
>
> On Thursday, October 9, 2008 7:11:18 PM UTC+5:30, acl68 wrote:
>>
>> Hi all,
>>
>> Now that I have placed a function in my model rather than in my
>> controller to avoid requestAction I have a new problem:
>>
>> The function gets data from my session.
>> In the controller the following works:
>> $user = $this->Session->read('User');
>>
>> When I place this code in my model method I get the error message:
>> Undefined variable: Session [APP\models\text.php, line 95]
>>
>> So I tried to avoid this by using the function like that:
>> App::import('Model', 'Session');
>> $Session = new Session()
>> $user = $Session->read('User');
>>
>> This causes:
>> Fatal error: Class 'Session' not found in...
>>
>> Questions: Is it possible to use Session data in my model? If yes which
>> syntax is correct?
>>
>> Thanks in advance!
>>
>> Anja
>>
>> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php