#1109: related records are inserted again when using postInsert() hook
------------------------+---------------------------------------------------
Reporter: mahono | Owner: romanb
Type: defect | Status: new
Priority: critical | Milestone: 1.0.4
Component: Listeners | Version: 1.0.0
Resolution: | Keywords: postInsert() related record
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
------------------------+---------------------------------------------------
Old description:
> In a record I use postInsert() to update stripped_title (as I put the id
> as prefix to it) and save() the record again.
>
> However, I also have related tags and these related records are inserted
> again (I can see this from the symfony log file) when the save() method
> is executed in postInsert(). This leads to a
> Doctrine_Connection_Mysql_Exception (eg.: SQLSTATE[23000]: Integrity
> constraint violation: 1062 Duplicate entry '43-12' for key 1)
>
> There could be something wrong with the record state(s) during
> postInsert() - maybe even other hooks!?
New description:
In a record I use postInsert() to update stripped_title (as I put the id
as prefix to it) and save() the record again.
However, I also have related tags and these related records are inserted
again (I can see this from the symfony log file) when the save() method is
executed in postInsert(). This leads to a
Doctrine_Connection_Mysql_Exception (eg.: SQLSTATE[23000]: Integrity
constraint violation: 1062 Duplicate entry '43-12' for key 1)
There could be something wrong with the record state(s) during
postInsert() - maybe even other hooks!?
Comment (by guilhermeblanco):
Although this may be a bug, there're another possibility that you can do
while using Doctrine 1.1+.
Since you need stripped_title, you can create an accessor and use it
without any headaches.
All you need to do is to implement getStrippedTitle method inside your
model class.
Regards,
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1109#comment:8>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" 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.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---