Sunday, March 27, 2011

Re: Session in Model

I have to say that reading from and writing to the session within a model is appealing, and will watch this thread with interest. I often find my controller code is too bloated because of interaction with Session.

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 28 Mar 2011, at 05:54, Krissy Masters wrote:

> Why is the Session data not available in the Model?
> Why is it breaking MVC?
> I do not understand since all data comes from the database basically and if
> I am saving my session data to the db why would grabbing that data in the
> model be bad?
>
> I found Miles J snip for the app_model which I plan to use to get session
> data since it makes more sense to grab user.id from the session directly in
> the model rather than grab it in controller only to pass it to the model in
> the controller function to be used in the model function.
>
> public function __construct($id = false, $table = null, $ds = null) {
> parent::__construct($id, $table, $ds);
>
> $this->Session = new CakeSession();
> }
>
> Any insight on how this breaks MVC?
>
> Thanks guys,
>
> K
>
>
>
> --
> 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
> cake-php+unsubscribe@googlegroups.com 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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: