Wednesday, November 23, 2011

Re: Confused: Trying to get values from a table outside of the controller.

100% Granted!

On Wed, Nov 23, 2011 at 2:18 AM, Jeremy Burns | Class Outfit <jeremyburns@classoutfit.com> wrote:
Don't just rely on recursion. Always use the containable behaviour.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 23 Nov 2011, at 02:05, Ma'moon wrote:

If there is any kind of association between `Post` and `Period` models then you can easily play with model's `recursive` flag to obtain what you want, otherwise you may manually load `Period` model in your `PostsController` and fetch the information you seek, code language:
$this->loadModel('Period');
$this->set('periods', $this->Period->find('all'));

On Mon, Nov 21, 2011 at 7:53 PM, GG <jairuskerz@gmail.com> wrote:
I have a PostsController. I have a posts table. I can easily get the
information I need from that table. I am trying to get information
from my periods table, from my posts controller. I am confused on how
to best do that. This is how I get the information from my posts
table.

( I am getting all info in the posts table, where user_id = *logged in
user*, class_period = 1, and created on todays date.)

$this->set('period1', $this->Post->find('all', array(
                                                          'conditions'=>array('user_id'=>$this->Session-
>read('Auth.User.id'), 'class_period'=>1, 'created' => date('Ymd'))
                                                          )));


( I want to get all info in the periods table, where user_id=*logged
in user* )

But I do not know how to get the values of the periods table from the
PostsController.

Thanks!

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

--
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: