I am starting out with Cake after messing with RoR for a while. I
jumped right in with a project where 'ArtWorks' are organized into
'Projects'. I wrote it all thusly:
=======================================
class Project extends AppModel
{
    var $hasMany = array('PubWorks' => array('className' => 'ArtWork',
                               'foreignKey'    => 'project_id',
                               'dependent'     => true,
                               'exclusive'     => false));
}
-------------
class ArtWork extends AppModel
{
    var $belongsTo = array('Project' =>
        array('className'  => 'Project',
            'foreignKey' => 'project_id'
        )
    );
}
------------
class ProjectsController extends AppController
{

    function show($id)
    {
        $w = $this->Project->read();
        print "<pre>DEBUG: at line " . __LINE__ . ' of ' . __FILE__ .
"\n";
        print_r($w);
        print '</pre>';
    }
}
=================================

I have set up the DB correctly with FKs using mySQL InnoDB. And
entered some sample data. But when I call http://localhost/projects/show/2

I get the debug dump of:
====================
DEBUG: at line 8 of /xxx/cake_1.2.0.6311-beta/app/controllers/
projects_controller.php
Array
(
    [Project] => Array
        (
            [id] => 2
            [name] => War Room
            [begin_date] => 0000-00-00
        )

)
=====================

no sign of the ArtWorks belonging to the Project. The SQL dumps show
the artworks table was never queried. I am out of ideas, according to
the manual this should work right? What am I missing?

thanks
Sam


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to