Re: Cascade delete and HABTM

2011-09-20 Thread WebbedIT
You would not want to delete the associated Service as the nature of
HABTM means that Service could be associated with any number of other
ServiceCategory.

HTH, Paul

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cascade delete and HABTM

2011-09-20 Thread xamako
Hi!

I was wrong thinking on HABTM. Everything is working ok :-)

Thanks!

On 20 sep, 12:01, WebbedIT p...@webbedit.co.uk wrote:
 You would not want to delete the associated Service as the nature of
 HABTM means that Service could be associated with any number of other
 ServiceCategory.

 HTH, Paul

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cascade delete and HABTM

2011-09-19 Thread Thomas Ploch

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cascade delete and HABTM

2011-09-19 Thread xamako
The dependent key is not avaible en HABTM
http://book.cakephp.org/es/view/1044/hasAndBelongsToMany-HABTM

Thanks

On 19 sep, 16:41, Thomas Ploch profipl...@googlemail.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cascade delete and HABTM

2011-09-19 Thread xamako
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 xam...@gmail.com 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 profipl...@googlemail.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php