Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @author Antoine Hedgecock <[email protected]>
*/
/**
* @namespace
*/
namespace MCN;
use Zend\Log\Logger,
<?php
/**
* @author Antoine Hedgecock <[email protected]>
*/
/**
* @namespace
*/
namespace MCNCore\Object;
use Zend\Mvc\MvcEvent,
<?php
/**
* @author Antoine Hedgecock <[email protected]>
*/
/**
* @namespace
*/
namespace Company\Controller;
use Zend\View\Model\ViewModel,
<?php
/**
* @author Antoine Hedgecock <[email protected]>
*/
/**
* @namespace
*/
namespace MCNCore\Object;
use Zend\Mvc\MvcEvent,
// Override the ZDT_DbCollector
'ZDT_DbCollector' => function($sm) {
$logs = $sm->get('doctrine.entitymanager.orm_default');
->getConnection()
->getConfiguration()
->getSQLLogger();
return new \MCNCore\Object\Profiler($logs);
}
<?php
/**
* @author Antoine Hedgecock <[email protected]>
*/
/**
* @namespace
*/
namespace User\Form\Fieldsets;
use Zend\Form\Fieldset,
$sm->get('view_manager')
->getHelperManager()
->addInitializer(function($instance) use ($sm) {
if ($instance instanceof ServiceLocatorAwareInterface) {
$instance->setServiceLocator($sm);
}
});
/**
* Sets one or multiple options
*
* @param array|Traversable $options Options to set
* @throws Exception\InvalidArgumentException If $options is not an array or Traversable
* @return AbstractValidator Provides fluid interface
*/
public function setOptions($options = array())
{
public function setServiceManager(ServiceManager $serviceManager)
{
$this->get('user')
->setHydrator($serviceManager->get('entityHydrator'));
$filter = $this->getInputFilter();
// We need to add a few filters
$email = $filter->get('user')
->get('email');
->add(
array(
'name' => 'email',
'validators' => array(
array(
'name' => 'callback',
'priority' => PHP_INT_MAX,
'options' => array(
'callback' => function($fo) {