Skip to content

Instantly share code, notes, and snippets.

View bakura10's full-sized avatar

Michaël Gallego bakura10

View GitHub Profile
/**
* The task is to rewrite the Hydrator component using the RecursiveIteratorIterator stuff. This will allow us A LOT
* of nice stuff, while being able to still have speed thanks to the C implementation. The most important things of
* using RecursiveIteratorIterator is to allow the usage of setMaxDepth, as well as plug FilterIterator (current hydrator
* filters are slow)
*
* The idea is to allow the hydrators recursively hydrate other things. For instance, if we have:
*/
class ObjectA
Another idea I had was to create a pre_routing middleware, that would change the URL, so that next step Expressive would
"dispatch" to the next middleware
<?php
class MyMiddleware
{
private $mapping;
public function __invoke($request, $response, $out)
{
$var = $request->getAttribute('job');
$middleware = $this->mapping[$var];
hpclass AdminEditForm extends Form
{
/**
* {@inheritDoc}
*/
public function init()
{
$this->add(array(
'type' => 'User\Form\UserFieldset',
'name' => 'user',
<?php
public function coucou()
{
foreach ($this->nSide as $n) {
$n->setMyFlag(true);
}
}
<?php
namespace SlmQueue\Controller;
use SlmQueue\Controller\Exception\WorkerProcessException;
use SlmQueue\Exception\SlmQueueExceptionInterface;
use SlmQueue\Worker\WorkerInterface;
use Zend\Mvc\Controller\AbstractActionController;
/**
/**
* @license MIT
* @author Michaël Gallego <mic.gallego@gmail.com>
*/
class RestAggregateHydrator extends AggregateHydrator
{
/**
* Hydrators are runned in a specific order to allow pre-process at each step
*/
const PAGINATOR_PRIORITY = 500;
<?php
return array(
'queue_manager' => array(
'my-object' => array(
'factory' => 'MyFactory',
'options' => array(
)
),
<?php
/**
* @ORM\Entity
* @REST\Controller(item="UserItemController", collection="UsersController")
*/
class User
{
/**
* @REST\ExposeAssociation
public function getLatestMissions($categoryId = null, $query = null)
{
$qb = $this->getEntityManager()->createQueryBuilder();
// blabla
$query = $qb->getQuery()
->useResultCache(true, 480);
$paginatorAdapter = new PaginatorAdapter(new DoctrinePaginator($query, true));