Skip to content

Commit

Permalink
Trigger thread denormalization using doctrine lifecycle events
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 28, 2011
1 parent 27d832c commit 3254929
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Document/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public function getMessages()
public function addMessage(MessageInterface $message)
{
$this->messages->add($message);
$this->denormalize();
}

/**
Expand Down Expand Up @@ -160,7 +159,7 @@ public function setIsDeletedByParticipant(ParticipantInterface $participant, $is
/**
* Performs denormalization tricks
*/
protected function denormalize()
public function denormalize()
{
$this->doParticipants();
$this->doKeywords();
Expand Down
5 changes: 5 additions & 0 deletions Resources/config/doctrine/Thread.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

<field name="subject" column="subject" type="string" />

<lifecycle-callbacks>
<lifecycle-callback type="prePersist" method="denormalize" />
<lifecycle-callback type="preUpdate" method="denormalize" />
</lifecycle-callbacks>

</mapped-superclass>

</doctrine-mapping>

0 comments on commit 3254929

Please sign in to comment.