This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function markAsRead(ThreadEntity $thread, UserEntity $user) | |
{ | |
$queryBuilder = $this->getEntityManager()->createQueryBuilder(); | |
$queryBuilder->update('u') | |
->set('u.status', UserThreadEntity::READ) | |
->set('u.firstNotReadMessage', null) | |
->from('NhxSimpleMessaging\Entity\UserThread', 'u') | |
->where('u.user = :user') | |
->andWhere('u.thread = :thread') | |
->setParameter('user', $user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getLatestThreads(UserEntity $user) | |
{ | |
$dql = 'SELECT t FROM Thread t ' . | |
'JOIN UserThread u WITH u.user = :user AND u.status <> :deleted ' . | |
'JOIN Message m WITH t = m.thread ' . | |
'JOIN Message m2 WITH t = m2.thread AND m.id < m2.id ' . | |
'WHERE m2.id IS NULL ' . | |
'ORDER BY m.sentAt DESC'; | |
$query = $this->getEntityManager()->createQuery($dql) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'resolve_target_entities' => array( | |
'orm_default' => array( | |
array( | |
'old_entity' => 'fff', | |
'new_entity' => 'gggg', | |
'mapping' => 'regtrg' | |
) | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->threadService->getEventManager()->attach('create', function ($e) use ($participantC) { | |
$thread = $e->getParam('thread'); | |
$thread->addParticipant($participantC); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @ORM\Entity | |
* @ORM\Table(name="Messages") | |
* @ORM\HasLifecycleCallbacks | |
*/ | |
class Message | |
{ | |
/** | |
* @var int | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'resolve_target_entities' => array( | |
'NhxUser\Entity\UserInterface' => array( | |
'new_entity' => 'NhxPrivateMessagingTest\Asset\SimpleUserTest' | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->add(array( | |
'type' => 'Zend\Form\Element\Select', | |
'options' => array( | |
'label' => 'my option' | |
), | |
'attributes' => array( | |
'options' => array(key value array) | |
) | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Folder | |
{ | |
/** | |
* @var Folder | |
* | |
* @ORM\ManyToOne(targetEntity="Folder", inversedBy="childrenFolders") | |
* @ORM\JoinColumn(onDelete="cascade") | |
*/ | |
protected $parentFolder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getServiceConfig() | |
{ | |
return array( | |
'invokables' => array( | |
'MyFooMapper' => 'My\Mapper\Foo' | |
), | |
'aliases' => array( | |
'ApplicationNameNotExists' => 'My\Validator\NameNotExists' | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dans ton layout : | |
<?php echo $this->placeholder('widget'); ?> | |
// Dans un hypothétique fichier Messagerie/view/messagerie/widget.phtml : | |
<?php $this->placeholder('widget')->captureStart(); ?> | |
<h1>Mon widget<h1> |