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
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 {
@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
@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
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
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