Skip to content

Instantly share code, notes, and snippets.

View bakura10's full-sized avatar

Michaël Gallego bakura10

View GitHub Profile
// Before:
return [
'slm_queue' => [
'worker' => [
'max_runs' => 500
],
'queue_manager' => [
'factories' => [
class DoctrineQueueFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*/
public function createService(ServiceLocatorInterface $serviceLocator, $name = '', $requestedName = '')
{
$parentLocator = $serviceLocator->getServiceLocator();
/** @var $doctrineOptions \SlmQueueDoctrine\Options\DoctrineOptions */
<?php
return [
'slm_queue' => [
'options' => [
'worker' => [
//worker options
],
// Configure each queues
<?php
/**
* If for instance a plugin manager has the following config:
*
* [
* 'invokables' => [
* 'formDateSelect' => 'Zend\Form\Element\DateSelect'
* ]
* ]
*
public function getIterator()
{
if (version_compare(PHP_VERSION, '5.5.0') < 0) {
return $this;
}
foreach ($this->routes as $name => $route) {
$route = $this->get($name);
yield $route;
}
<?php
$events = array();
$events['event'][] = array(1 => 'e');
$events['event'][] = array(1 => 'b');
$toSort = $events['event'];
asort($toSort);
?>
@bakura10
bakura10 / foo.php
Last active December 27, 2015 11:39
<?php
return array(
'zfc_rbac' => array(
'permissions' => array(
// Définition des providers. Exemple (syntaxe à réfléchir voir si on peut pas trouver mieux)
'ZfcRbac\Permission\InMemoryPermissionProvider' => array(
'member' => array('edit', 'read'),
'admin' => array('delete')
'zf-content-negotiation' => array(
'selectors' => array(
'ZF\Hal\View\HalJsonModel' => array(
'application/json',
'application/*+json',
),
),
),
<?php
$allowedMethods = array('options', 'put');
$response->getHeaders()->addHeaderLine('Allow', implode(', ', $allowedMethods));
echo $response->getHeaders()->get('Allow')->getFieldValue(); // also outputs "post"
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Validator\Result;