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
<?php | |
namespace Common\Authentication\Storage; | |
use Doctrine\Common\Persistence\ObjectRepository; | |
use Zend\Authentication\Storage\StorageInterface; | |
/** | |
* This class implements StorageInterface and allow to save the result of an authentication against a database | |
*/ |
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 indexAction() | |
{ | |
$filters = $this->request->getQuery(); | |
// Activate the filter, giving it filters values | |
$students = $this->getStudentService()->getAll(); | |
return array( | |
'students' => $students->setCurrentPageNumber(1) |
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
// In controller : | |
/** | |
* Show all the students | |
* | |
* @return array | |
*/ | |
public function indexAction() | |
{ | |
$studentService = $this->getStudentService(); |
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\Collection', | |
'name' => 'properties', | |
'options' => array( | |
'label' => 'Please choose properties for this Asset', | |
'count' => 2, | |
'should_create_template' => true, | |
'allow_add' => true, | |
'target_element' => array( | |
'type' => 'DoctrineORMModule\Form\Element\DoctrineEntity', |
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->metadata->expects($this->exactly(2)) | |
->method('hasAssociation') | |
->with($this->equalTo('country')) | |
->will($this->returnValue(true)); |
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
<?php | |
namespace Common\Authentication\Service; | |
use DoctrineModule\Authentication\Adapter\ObjectRepository as DoctrineAdapter; | |
use DoctrineModule\Authentication\Storage\ObjectRepository as DoctrineStorage; | |
use DoctrineModule\Options\Authentication as AuthenticationOptions; | |
use Zend\Authentication\AuthenticationService; | |
use Zend\Authentication\Storage\Session as SessionStorage; | |
use Zend\ServiceManager\FactoryInterface; |
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
<?php | |
namespace Common\Authentication\Service; | |
use DoctrineModule\Authentication\Adapter\ObjectRepository as DoctrineAdapter; | |
use DoctrineModule\Authentication\Storage\ObjectRepository as DoctrineStorage; | |
use DoctrineModule\Options\Authentication as AuthenticationOptions; | |
use Zend\Authentication\AuthenticationService; | |
use Zend\Authentication\Storage\Session as SessionStorage; | |
use Zend\ServiceManager\FactoryInterface; |
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
<?php | |
namespace Common\Service; | |
use Doctrine\ORM\EntityManager; | |
use Zend\Authentication\AuthenticationService; | |
use Zend\ServiceManager\ServiceManager; | |
use Zend\ServiceManager\ServiceManagerAwareInterface; |
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
/** | |
* @param Message $message | |
* @return Thread | |
*/ | |
public function addMessage(Message $message) | |
{ | |
if ($this->status === self::OPENED) { | |
foreach ($this->participants as $participant) { | |
if ($participant->getUser() === $message->getAuthor()) { | |
$participant->setFirstNotReadMessage(null); |
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 Thread extends AbstractService | |
{ | |
/** | |
* @param ThreadEntity $thread | |
*/ | |
public function create(ThreadEntity $thread) | |
{ | |
// I'm in a module, it does not have idea of what the specific application needs... but in my application, I need to add // another specific participant... | |
$user = $this->getAuthenticationService()->getIdentity(); | |
$thread->addParticipant($user); |