Hi I have three tables all linked to one lookup table like so:

+-----------------------------------------------------------------------------
+
 | AUXProductOption                                                 |
+----
+-----------------------------------------------------------------------
+
| id | productOptionName                                            |
+----
+-----------------------------------------------------------------------
+
|  1 | Death, Total and Permanent Disability, Tempor    |
|  5 | total,
540                                                           |
|  6 | test fixed amount
|
+----
+-----------------------------------------------------------------------
+

+-----------------------------------------------------------------------------
+
 | AUXProductOptionFields                                        |
+----
+-----------------------------------------------------------------------
+
| id    |
name                                                             |
+----
+-----------------------------------------------------------------------
+
|  1   | Test
Field                                                        |
+----
+-----------------------------------------------------------------------
+

+-----------------------------------------------------------------------------
+
 | AUXProductOptionFieldValue                                  |
+----
+-----------------------------------------------------------------------
+
| id    |
value                                                              |
+----
+-----------------------------------------------------------------------
+
|  1   |
1001                                                               |
|  2   | This is rover calling back huston                       |
+----
+-----------------------------------------------------------------------
+

+-------------------------------------------------------------------------------------------------------------------------------
+
 |
AUXProductOption_has_AUXProductOptionFields
|
+-------------------------------------------------------------------------------------------------------------------------------
+
| AUXProductOption_id | AUXProductOptionFields_id |
AUXProductOptionFieldValue_id   |
+--------------------------------
+-----------------------------------------
+---------------------------------------------------+
|                   1            |
1                |                             1
|
|                   1            |
1                |                             2
|
|                   5            |
1                |                             2
|
|                   6            |
1                |                             1
|
+-------------------------------
+------------------------------------------
+---------------------------------------------------+

my models look like so :
[CODE]
class AUXProductOption extends AppModel {
        var $name = 'AUXProductOption';
        var $useTable = 'AUXProductOption';
        var $displayField = 'productOptionName';
        //The Associations below have been created with all possible keys,
those that are not needed can be removed

        var $hasAndBelongsToMany = array(
                'AUXProductOptionField' => array(
                        'className' => 'AUXProductOptionField',
                        'joinTable' => 
'AUXProductOption_has_AUXProductOptionFields',
                        'foreignKey' => 'AUXProductOptionFields_id',
                        'associationForeignKey' => 'AUXProductOption_id',
                        'unique' => true,
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'limit' => '',
                        'offset' => '',
                        'finderQuery' => '',
                        'deleteQuery' => '',
                        'insertQuery' => ''
                ),
                'AUXProductOptionFieldValue' => array(
                        'className' => 'AUXProductOptionFieldValue',
                        'joinTable' => 
'AUXProductOption_has_AUXProductOptionFields',
                        'foreignKey' => 'AUXProductOptionFieldValue_id',
                        'associationForeignKey' => 'AUXProductOption_id',
                        'unique' => true,
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'limit' => '',
                        'offset' => '',
                        'finderQuery' => '',
                        'deleteQuery' => '',
                        'insertQuery' => ''
                )
        );

}

class AUXProductOptionField extends AppModel {
        var $name = 'AUXProductOptionField';
        var $useTable = 'AUXProductOptionFields';
        var $displayField = 'name';

        var $hasAndBelongsToMany = array(
                'AUXProductOptionFieldValue' => array(
                        'className' => 'AUXProductOptionFieldValue',
                        'joinTable' => 
'AUXProductOption_has_AUXProductOptionFields',
                        'foreignKey' => 'AUXProductOptionFieldValue_id',
                        'associationForeignKey' => 'AUXProductOptionFields_id',
                        'unique' => true,
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'limit' => '',
                        'offset' => '',
                        'finderQuery' => '',
                        'deleteQuery' => '',
                        'insertQuery' => ''
                ),
                'AUXProductOption' => array(
                        'className' => 'AUXProductOption',
                        'joinTable' => 
'AUXProductOption_has_AUXProductOptionFields',
                        'foreignKey' => 'AUXProductOption_id',
                        'associationForeignKey' => 'AUXProductOptionFields_id',
                        'unique' => true,
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'limit' => '',
                        'offset' => '',
                        'finderQuery' => '',
                        'deleteQuery' => '',
                        'insertQuery' => ''
                )
        );
}

class AUXProductOptionFieldValue extends AppModel {
        var $name = 'AUXProductOptionFieldValue';
        var $useTable = 'AUXProductOptionFieldValue';
        var $displayField = 'value';
        //The Associations below have been created with all possible keys,
those that are not needed can be removed

        var $hasAndBelongsToMany = array(
                'AUXProductOptionField' => array(
                        'className' => 'AUXProductOptionField',
                        'joinTable' => 
'AUXProductOption_has_AUXProductOptionFields',
                        'foreignKey' => 'AUXProductOptionFields_id',
                        'associationForeignKey' => 
'AUXProductOptionFieldValue_id',
                        'unique' => true,
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'limit' => '',
                        'offset' => '',
                        'finderQuery' => '',
                        'deleteQuery' => '',
                        'insertQuery' => ''
                ),
                'AUXProductOption' => array(
                        'className' => 'AUXProductOption',
                        'joinTable' => 
'AUXProductOption_has_AUXProductOptionFields',
                        'foreignKey' => 'AUXProductOption_id',
                        'associationForeignKey' => 
'AUXProductOptionFieldValue_id',
                        'unique' => true,
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'limit' => '',
                        'offset' => '',
                        'finderQuery' => '',
                        'deleteQuery' => '',
                        'insertQuery' => ''
                )
        );

}

[/CODE]

My problem currently is that I cannot do inserts and the data is read
out only for the first product option with the first field value.

Thanks in advance.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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