#6006: Saving a model with non-trivial HABTM relation does not delete previous
relationships.
--------------------------+-------------------------------------------------
    Reporter:  Jafinto    |          Type:  Bug    
      Status:  new        |      Priority:  Medium 
   Milestone:  1.2.x.x    |     Component:  Model  
     Version:  1.2 Final  |      Severity:  Trivial
    Keywords:             |   Php_version:  n/a    
Cake_version:             |  
--------------------------+-------------------------------------------------
 I'm using two models: Album and Song. These models both have a HABTM
 relationship with each other. The SQL join table albums_songs consists of
 four fields: id, album_id, song_id and track_number.
 [[BR]][[BR]]
 When I try to save a song, I set Song->id to the right id and pass the
 following array to Song->save:
 {{{
 array(
     'Song' => array(
         *SongInfo
     ),
     'Album' => array(
         'Album' => array(
             array(
                 'album_id' => 9,
                 'track_number' => 1
             )
         )
     )
 );
 }}}
 This does save the song, but it also adds a relationship to the
 albums_songs table without removing existing ones. This is not intended,
 because in the HABTM relationship the option unique is set to true.
 [[BR]][[BR]]
 I have attached a patch against 1.2.x.x trunk.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6006>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to