Do you know what version of CakePHP you are running?


On Feb 16, 10:00 am, Furuno <furunom...@gmail.com> wrote:
> Nope... :(
>
> Just to make sure, I tried that once again with :
> $this->set('subjects', $this->Subject->find('all'));
>
> still no luck...
>
> On 17 Feb, 00:56, andy <sum...@gmail.com> wrote:
>
>
>
> > Does it work if you try doing a $this->Subject->find() instead of
> > using paginate?  Just to see if that works...
>
> > On Feb 16, 9:37 am, Furuno <furunom...@gmail.com> wrote:
>
> > > Okay, so, I have two models called Program and Subject, here's the
> > > classes :
>
> > > program.php
> > > <?php
> > > class Program extends AppModel {
> > >         var $hasMany = 'Subject';}
>
> > > ?>
>
> > > subject.php
> > > <?php
> > > class Subject extends AppModel {
> > >         var $belongsTo = 'Program'}
>
> > > ?>
>
> > > And the controllers :
>
> > > programs_controller.php
> > > <?php
> > > class ProgramsController extends AppController {
>
> > >         var $paginate = array('limit' => 20);
>
> > >         function admin_index() {
> > >                 $this->set('programs', $this->paginate('Program'));
> > >         }}
>
> > > ?>
>
> > > subjects_controller.php
> > > <?php
> > > class SubjectsController extends AppController {
>
> > >         var $paginate = array('limit' => 20);
>
> > >         function admin_index() {
> > >                 $this->set('subjects', $this->paginate('Subject'));
> > >         }
>
> > > }
>
> > > ?>
>
> > > The problem is, why the subject controller won't load the associated
> > > models while all the other controllers (programs and periodes) does it
> > > just find?
>
> > > Here's the SQL debug message from programs controller, it loads the
> > > associated Subjects :
> > > DESCRIBE `programs`
> > > DESCRIBE `subjects`
> > > SELECT COUNT(*) AS `count` FROM `programs` AS `Program` WHERE 1 = 1
> > > SELECT `Program`.`id`, `Program`.`code`, `Program`.`name`,
> > > `Program`.`description` FROM `programs` AS `Program` WHERE 1 = 1 LIMIT
> > > 20
> > > SELECT `Subject`.`id`, `Subject`.`program_id`, `Subject`.`periode_id`,
> > > `Subject`.`code`, `Subject`.`name`, `Subject`.`description` FROM
> > > `subjects` AS `Subject` WHERE `Subject`.`program_id` IN (1, 2, 3)
>
> > > But in the subjects controller it doesn't load the associated
> > > Programs :
> > > DESCRIBE `subjects`
> > > SELECT COUNT(*) AS `count` FROM `subjects` AS `Subject` WHERE 1 = 1
> > > SELECT `Subject`.`id`, `Subject`.`program_id`, `Subject`.`periode_id`,
> > > `Subject`.`code`, `Subject`.`name`, `Subject`.`description` FROM
> > > `subjects` AS `Subject` WHERE 1 = 1 LIMIT 20
>
> > > I've tried adding a complete association definition array to the
> > > models, complete pagination definition array, using var $name but
> > > still no luck :(
>
> > > Where did I went wrong? Have debugged this for the last 2 hours...
>
> > > Thanks before...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to