My models are:
#Service
class Service extends AppModel {
var $name = 'Service';
var $hasAndBelongsToMany = array(
'ServiceCategorie' => array(
'className' => 'ServiceCategorie',
'joinTable' => 'servicecategories_services',
'foreignKey' => 'service_id',
'associationForeignKey' => 'service_categorie_id'
)
);
}
#ServiceCategorie
class ServiceCategorie extends AppModel {
var $name = 'ServiceCategorie';
var $hasAndBelongsToMany = array (
'Service' => array (
'className' => 'Service',
'joinTable' => 'servicecategories_services',
'conditions' => '',
'order' => '',
'limit' => '',
'unique' => true,
'foreignKey' => 'service_categorie_id',
'associatedKey' => 'service_id',
'with' => 'ServiceCategorieService',
),
);
}
#ServiceCategorieService
class ServiceCategorieService extends AppModel {
var $name = 'ServiceCategorieService';
var $useTable = 'servicecategories_services';
}
On 19 sep, 16:52, xamako <[email protected]> wrote:
> The "dependent" key is not avaible en
> HABTMhttp://book.cakephp.org/es/view/1044/hasAndBelongsToMany-HABTM
>
> Thanks
>
> On 19 sep, 16:41, Thomas Ploch <[email protected]> wrote:
>
>
>
>
>
>
>
> > Have you set the 'dependent' key in *both* relationship configurations?
>
> > Kind regards
> > Thomas
>
> > Am 19.09.2011 16:32, schrieb xamako:
>
> > > Hi!
>
> > > I have the following relationship between HABTM tables:
>
> > > - services
> > > - service_categories
> > > - Servicecategories_services (the latter is what links the two tables
> > > above)
>
> > > Well, what I get is that when you delete a table record
> > > service_categories, records are automatically deleted from the table
> > > "services" that are linked through the table
> > > "servicecategories_services" ... but for some reason not behaves as
> > > expected.
>
> > > Deleting a record from table "service_categories" automatically
> > > deletes the records from table "servicecategories_services" but does
> > > not remove records from the table "services"
>
> > > What am I doing wrong?
>
> > > Can anyone give me a solution?
>
> > > A greeting and 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