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
The form row helper is a utility helper that allow to reduce the boilerplate code of a view file by automatically generating a label (if specified), a form element and errors that may arise during validation. | |
Simple example | |
Let's add an element : | |
$this->add(array( | |
'type' => 'Zend\Form\Element\Color', | |
'name' => 'one_color' | |
)); |
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
The simplest case allow to have the same element, multiple time. For instance, let's say we want to have two colors : | |
$element = new \Zend\Form\Element\Color(); | |
$this->add(array( | |
'type' => 'Zend\Form\Element\Collection', | |
'name' => 'colors', | |
'attributes' => array( | |
'count' => 2, | |
'targetElement' => $element | |
) |
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 CreateForm extends \Zend\Form\Form | |
{ | |
public function __construct() | |
{ | |
parent::__construct('create_address'); | |
$this->setAttribute('method', 'post') | |
->setHydrator(new ClassMethodsHydrator()) | |
->setInputFilter(new InputFilter()); |
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->setValidationGroup('company' => array('id'), 'year', 'month'); |
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
// FIRST : | |
class Register extends Form | |
{ | |
/** | |
* Init the form | |
*/ | |
public function init() | |
{ | |
$this->setHydrator(new ClassMethodsHydrator()) |
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 my controller : | |
/** | |
* @return array | |
*/ | |
public function logoutAction() | |
{ | |
$this->getUserService()->logout(); | |
return $this->redirect()->toRoute('home'); | |
} |
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 | |
<?php | |
/** | |
* Doctrine ORM Configuration | |
*/ | |
return array( | |
'doctrine' => array( | |
'driver' => array( | |
'application_driver' => 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
SELECT | |
COUNT(a0_.id) AS sentApplications, | |
SUM(IF(a0_.status = 16, 1, 0)) AS acceptedApplications, | |
SUM(IF(a0_.status = 32 AND m1.`status` = 1, 1, 0)) as finished | |
FROM Applications a0_ | |
JOIN Missions m1 ON a0_.mission_id = m1.id | |
WHERE a0_.student_id = 7 |
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\Options; | |
use Zend\Stdlib\AbstractOptions; | |
class Configuration extends AbstractOptions | |
{ | |
/** | |
* Entity's class name |
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 Common\Authentication\Options\Configuration as AuthenticationOptions; | |
use Common\Authentication\Storage\Db as DbStorage; | |
use DoctrineModule\Authentication\Adapter\DoctrineObjectRepository as DoctrineAdapter; | |
use Zend\Authentication\AuthenticationService; | |
use Zend\Authentication\Storage\Session as SessionStorage; | |
use Zend\ServiceManager\FactoryInterface; |
OlderNewer