Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
$oVideo = Doctrine_Core::getTable ("Model_Video")->find (500);
$oVideo = new Model_Video ();
$oVideo->assignIdentifier (500);$oTag = Doctrine_Core::getTable ("Model_Tag")->find (500);
$oVideo->tags->clear ();
$oVideo->tags[] = $oTag;
$oVideo->save ();
The previous code can be execute a lot of time.
Now, let us create the Doctrine_Collection.
$oVideo = Doctrine_Core::getTable ("Model_Video")->find (500);
$oVideo = new Model_Video ();
$oVideo->assignIdentifier (500);$oTag = Doctrine_Core::getTable ("Model_Tag")->find (500);
$oVideo->tags = new Doctrine_Collection ("Model_Tag");
$oVideo->tags[] = $oTag;
$oVideo->save ();
Doctrine create a relation between the video and tag. It doesn't update it.
If the relation already exists into the database, Doctrine create an other record, or the DB throw an integrity error if you have constraint.