I have an app I'm trying to convert to Cake, which basically spits out
a menu of products. Therefore, the Menu class (and others) needs to
hold many different products in several fields. I do not have a lookup
table, because the app written procedurally (sp?) didn't need one. I've
tried to set up multiple associations within the same two Models, to no
avail. Here's how I have the models set up (Project and Enhancement):

class Project extends AppModel {
        var $name = 'Project';
        var $hasMany = array('Furnace' =>
                               array('association' => 'Enhancement',
                                       'foreignKey' => 'standard_furnace' ),
                        'StandardTwo' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'standard_two' ),
                        'StandardThree' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'standard_three' ),
                        'StandardFour' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'standard_four' ),
                        'StandardFive' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'standard_five' ),
                        'OptionOne' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'option_one' ),
                        'OptionTwo' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'option_two' ),
                        'OptionThree' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'option_three' ),
                        'OptionFour' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'option_four' ),
                        'OptionFive' =>
                                array('association' => 'Enhancement',
                                       'foreignKey' => 'option_five' ));
        var $displayField = 'project_name';
        var $validate = array (
                'project_name'=>VALID_NOT_EMPTY);
}



class Enhancement extends AppModel {
        var $name = 'Enhancement';
        var $belongsTo = array('Furnace' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'standard_furnace' ),
                                'StandardTwo' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'standard_two' ),
                                'StandardThree' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'standard_three' ),
                                'StandardFour' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'standard_four' ),
                                'StandardFive' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'standard_five' ),
                                'OptionOne' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'option_one' ),
                                'OptionTwo' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'option_two' ),
                                'OptionThree' => array(
                                        'association' => 'Project',
                                      'foreignKey' => 'option_three' ),
                                'OptionFour' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'option_four' ),
                                'OptionFive' => array(
                                        'association' => 'Project',
                                        'foreignKey' => 'option_five' ));

        var $primaryKey = 'ID';
        //var $displayField = 'productTitle';
        var $validate = array (
                'productTitle'=>VALID_NOT_EMPTY,
                'productMenuBullets'=>VALID_NOT_EMPTY,
                'productCategory'=>VALID_NOT_EMPTY,
                'productPresBullets'=>VALID_NOT_EMPTY);
}


When I try to open the view for the Project, it spits out the error:

Parse error: parse error, unexpected T_VAR, expecting ',' or ';' in
/home/virtual/.../models/project.php

I'm pretty sure I've got the syntax OK. Any thoughts?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to