Skip to content

Commit

Permalink
Fixes relative to recent refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 28, 2011
1 parent b409625 commit 27d832c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Composer/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

use Ornicar\MessageBundle\ModelManager\MessageManagerInterface;
use Ornicar\MessageBundle\Sender\SenderInterface;
use Ornicar\MessageBundle\Model\ThreadInterface;
use Ornicar\MessageBundle\ModelManager\ThreadManagerInterface;
use Ornicar\MessageBundle\MessageBuilder\NewThreadMessageBuilder;
use Ornicar\MessageBundle\MessageBuilder\ReplyMessageBuilder;

/**
* Factory for message builders
Expand Down
1 change: 1 addition & 0 deletions FormHandler/AbstractMessageFormHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Ornicar\MessageBundle\FormModel\AbstractMessage;
use Ornicar\MessageBundle\Security\ParticipantProviderInterface;
use Ornicar\MessageBundle\Model\ParticipantInterface;
use Ornicar\MessageBundle\Sender\SenderInterface;

/**
* Handles messages forms, from binding request to sending the message
Expand Down
5 changes: 3 additions & 2 deletions FormHandler/NewThreadMessageFormHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ public function composeMessage(AbstractMessage $message)
{
return $this->composer->newThread()
->setSubject($message->getSubject())
->setRecipient($message->getRecipient())
->addRecipient($message->getRecipient())
->setSender($this->getAuthenticatedParticipant())
->setBody($message->getBody());
->setBody($message->getBody())
->getMessage();
}
}
3 changes: 2 additions & 1 deletion FormHandler/ReplyMessageFormHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function composeMessage(AbstractMessage $message)
{
return $this->composer->reply($message->getThread())
->setSender($this->getAuthenticatedParticipant())
->setBody($message->getBody());
->setBody($message->getBody())
->getMessage();
}
}
1 change: 1 addition & 0 deletions MessageBuilder/AbstractMessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function setBody($body)
public function setSender(ParticipantInterface $sender)
{
$this->message->setSender($sender);
$this->thread->addParticipant($sender);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion MessageBuilder/NewThreadMessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function setSubject($subject)
*/
public function addRecipient(ParticipantInterface $recipient)
{
$this->thread->addRecipient($recipient);
$this->thread->addParticipant($recipient);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Create a new message thread::

$message = $composer->newThread()
->setSender($jack)
->setRecipient($clyde)
->addRecipient($clyde)
->setSubject('Hi there')
->setBody('This is a test message')
->getMessage();
Expand Down

0 comments on commit 27d832c

Please sign in to comment.