Hi,

I have a problem to saving data in HABTM relation ship.

1) tags : tag_id, tag_name .
2) entity_types : entity_type_id, entity_type_name .   [(0, Posts),
3) teachers : teacher_id, teacher_name .
4) entities_tags : tag_id, entity_type_id, entity_id .

I am using HABTM relation ship between Tag and Teacher modal

*Teacher Model*
<?php
class Teacher extends AppModel {


    var $name = 'Teacher';


    var $hasAndBelongsToMany = array(
            'Tag' => array (
                'className' => 'Tag',
                'joinTable' => 'entities_tags',
                'foreignKey' => 'entity_id',
                'associationForeignKey' => 'tag_id',
                'conditions' => 'entity_type_id = 1'
            )
    );
}

?>

here 'entity_id', 'tag_id' is saving in database tabel
'entities_tags'  but 'entity_type_id  is not saving. here it's always
default value 0 is saving but it must be save1.

Please tell me where should I define 'entity_type_id  = 1  other than
relation ship so that it can be save.

or is there any solution so that I can be save one extra filed
'entity_type_id  in database with  'entity_id' , tag_id?


Thanks
--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to