filesname and model names should be in singular name e'  => 'Thesis',
-> theses  etc...

On 12 Lis, 00:08, "death.au" <[email protected]> wrote:
> If anyone's interested, it turns out it WAS a really noobish problem.
> I had the filenames for my models plural instead of singular (Category
> model was in categories.php) and that just threw everything off.
> Filenames are singular now (category.php) and it's all good.
>
> On Nov 11, 3:51 pm, "death.au" <[email protected]> wrote:
>
>
>
> > I'm relatively new to cakePHP and am trying to set up a simple thesis
> > review system in order to get my head around how it works. So keep in
> > mind I've probably missed something very basic.
>
> > For now, I'm just trying to display some information about a Thesis,
> > including the author and category, which are separate models. Because
> > this system is meant for a competition, authors of Theses are known as
> > Applicants. I have the following models:
>
> > class Applicant extends AppModel
> > {
> >         var $name = 'Applicant';
> >         var $hasMany = array(
> >                         'Thesis' => array('className'  => 'Thesis',
> >                                                          'foreignKey' => 
> > 'thesis_id')
> >         );
>
> > }
>
> > class Thesis extends AppModel
> > {
> >         var $name = 'Thesis';
>
> >         // Relationships
> >         var $hasMany = array(
> >                         'Rating' => array('className'  => 'Rating',
> >                                                          'foreignKey' => 
> > 'thesis_id')
> >         );
> >         var $belongsTo = array(
> >                         'Author' => array('className'  => 'Applicant',
> >                                                          'foreignKey' => 
> > 'applicant_id'),
> >                         'Category' => array('className'  => 'Category',
> >                                                          'foreignKey' => 
> > 'category_id')
> >         );
>
> > }
>
> > class Category extends AppModel
> > {
> >         var $name = 'Category';
>
> >         //Relationships
> >         var $hasMany = array(
> >                         'Thesis'        => array('className' => 'Thesis',
> >                                                                 
> > 'foreignKey' => 'category_id')
> >         );
>
> > }
>
> > And here is my thesis controller:
>
> > class ThesesController extends AppController{
> >         var $name = 'Theses';
> >         var $components = array("obAuth");
>
> >         function index() {
> >                 $this->set('theses', $this->Thesis->find('all', 
> > array('recursive' =>
> > 1)));
> >         }
>
> > }
>
> > I'm pretty sure that 'recursive' => 1 is the default, but I'm trying
> > things.
> > But in my theses/index view, I can get information from from the
> > $theses object, but there's no information within them for Author or
> > Category... I don't know what I'm doing wrong.
> > Perhaps someone can help me?

--

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


Reply via email to