Re: now Using Session on my model

2010-01-28 Thread Martin Radosta
A callback in the controller avoid a broken the MVC pattern. On 01/28/2010 02:20 PM, Jamie wrote: Well, it's certainly better than importing the component... If you want to be strict about it (and I'm not exactly sure how the method I suggests falls outside of the MVC pattern, since session i

Re: now Using Session on my model

2010-01-28 Thread Jamie
Well, it's certainly better than importing the component... If you want to be strict about it (and I'm not exactly sure how the method I suggests falls outside of the MVC pattern, since session info is just data, just like model data), then just make a model: class UserSession extends AppModel {

Re: now Using Session on my model

2010-01-27 Thread the_guru
@Jamie, Its not wrong , its just not best practice and fall out of palce for MVC design pattern i guess. On Jan 26, 3:45 am, Jamie wrote: > You don't need to import a component, especially since components are > for controllers. You can just do this in your Cart model: > > public $session = n

Re: now Using Session on my model

2010-01-25 Thread the_guru
@miles j, There is a post by mcurry http://www.pseudocoder.com/archives/2008/10/06/accessing-user-sessions-from-models-or-anywhere-in-cakephp-revealed/ where is shows how to access the auth component using static method calls. I was trying to find a easier way to access session from only the cart

Re: now Using Session on my model

2010-01-20 Thread Miles J
Ok, so what are you trying to convey here? Its usually against convention to go with this approach, as session data should be passed from the controller to the model. However, there are plans for a session datasource in Cake 1.3+. On Jan 20, 12:40 am, the_guru wrote: > Hello Every body i am now

now Using Session on my model

2010-01-20 Thread the_guru
Hello Every body i am now using Session component on my Cart model I have Cart Model which does not extends from AppModel Now here is the code that i am using to access Session properties class Cart { public $Session = null; public function __construct(){ App::im