0

CakePHP, Lynda.com “Up and Running with CakePHP” errors

I’m working through the above-mentioned crash course to make my workflow more efficient since I’m tired of re-coding lots of simple stuff.┬áThe instructor makes an error on section 2 (“Modeling Magazines in the Database”) on video 4 (“Linking models together with associations”).

By the time we get to section 4 (“Saving Time with Helpers and Components”) a glance at the instructor’s code shows something different than what he demonstrated in the previous section. Specifically, the following code sample is incorrect in Issue.php:

public $belongsTo = array(
'Publication' => array(
 'className' => 'Publication',
 'foreignKey' => 'issue_publication_id',
 )
 );

If you input “PublicationIssues” or whatever he instructs as the name of the first array, you’ll get “table not found” errors later in the tutorial. The above is what the instructor is himself using by section 4, so make your code look the same.

I believe the same issue arises with Publication.php. Change the name of the array.

Leave a Reply