Skip to content

Instantly share code, notes, and snippets.

View manuakasam's full-sized avatar

Manuel St. manuakasam

  • Germany, NRW, Duisburg
View GitHub Profile
@manuakasam
manuakasam / gist:3181179
Created July 26, 2012 09:21
Non working route
<?php
return array(
'router' => array(
'routes' => array(
'option' => array(
'type' => 'Literal',
'options' => array(
'route' => '/option',
'defaults' => array(
'__NAMESPACE__' => 'AssetManagement\Controller',
@manuakasam
manuakasam / gist:3181673
Created July 26, 2012 12:02
CSRF not working :(
$this->add(array(
'name' => 'security',
'type' => 'Zend\Form\Element\Csrf'
));
$this->add(array(
'name' => 'submit',
'attributes' => array(
'type' => 'submit',
'value' => 'Go',
@manuakasam
manuakasam / gist:3181674
Created July 26, 2012 12:02
CSRF not working :(
$this->add(array(
'name' => 'security',
'type' => 'Zend\Form\Element\Csrf'
));
$this->add(array(
'name' => 'submit',
'attributes' => array(
'type' => 'submit',
'value' => 'Go',
@manuakasam
manuakasam / gist:3182357
Created July 26, 2012 14:26
Create Doctrine based Form via Factory with Collections and Select Elements Hydratable
<?php
namespace Zebreco\Form;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zebreco\Entity\Ticket;
use DoctrineORMModule\Stdlib\Hydrator\DoctrineEntity as ClassMethods;
class TicketCreateFactory implements FactoryInterface
@manuakasam
manuakasam / gist:3182360
Created July 26, 2012 14:26 — forked from davidwindell/gist:3181965
ZF2 Select Element bound to Object
<?php
namespace My\Form\Element;
use Zend\Form\Element\Select as SelectElement;
class DepartmentSelect extends SelectElement
{
@manuakasam
manuakasam / gist:4085757
Created November 16, 2012 09:15
Base Class for Doctrine Entity Services
<?php
namespace MyNamespace\Service;
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Zend\ServiceManager\ServiceManager;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
<?php
namespace Kennzahlen\Service;
class Steuerwert extends DoctrineEntityService
{
/**
* @return \Doctrine\ORM\EntityRepository
*/
public function getEntityRepository()
{
<?php
namespace Haushaltportal\Form\Element;
use DoctrineModule\Form\Element\Proxy as BaseProxy;
class Proxy extends BaseProxy
{
/**
* @var string
*/
@manuakasam
manuakasam / gist:4352583
Created December 21, 2012 12:47
Usage for multi-property values on EntitySelect See https://gist.github.com/4352572
$this->add(array(
'name' => 'someName',
'type' => 'MyNamespace\Form\Element\EntitySelect',
'attributes' => array(
'required' => true
),
'options' => array(
'label' => 'Select element Label',
'empty_option' => '--- Choose Entity ---',
'object_manager' => $this->getEntityManager(),
<?php
class Foo
{
protected $labelCallable;
public function setLabelCallable($labelCallable)
{
$this->labelCallable = $labelCallable;
}