Skip to content

Instantly share code, notes, and snippets.

Michaël Gallego bakura10

Block or report user

Report or block bakura10

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bakura10 / Row helper use cases
Created Jun 29, 2012
Form Row Helper use cases
View Row helper use cases
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 :
'type' => 'Zend\Form\Element\Color',
'name' => 'one_color'
View gist:3025309
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();
'type' => 'Zend\Form\Element\Collection',
'name' => 'colors',
'attributes' => array(
'count' => 2,
'targetElement' => $element
bakura10 / gist:3028917
Created Jul 1, 2012
Multiple hydrator usage
View gist:3028917
class CreateForm extends \Zend\Form\Form
public function __construct()
$this->setAttribute('method', 'post')
->setHydrator(new ClassMethodsHydrator())
->setInputFilter(new InputFilter());
View gist:3067544
$this->setValidationGroup('company' => array('id'), 'year', 'month');
bakura10 / gist:3068163
Created Jul 7, 2012
Some code that make you want to use Zend\Registry
View gist:3068163
// FIRST :
class Register extends Form
* Init the form
public function init()
$this->setHydrator(new ClassMethodsHydrator())
View gist:3072082
// In my controller :
* @return array
public function logoutAction()
return $this->redirect()->toRoute('home');
View gist:3079195
* Doctrine ORM Configuration
return array(
'doctrine' => array(
'driver' => array(
'application_driver' => array(
View gist:3089590
COUNT( 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 =
WHERE a0_.student_id = 7
bakura10 / gist:3131450
Created Jul 17, 2012
View gist:3131450
namespace Common\Authentication\Options;
use Zend\Stdlib\AbstractOptions;
class Configuration extends AbstractOptions
* Entity's class name
bakura10 / gist:3131456
Created Jul 17, 2012
View gist:3131456
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;
You can’t perform that action at this time.