示例#1
0
 /**
  * Initialize
  *
  * @return void
  */
 public function initialize()
 {
     if ($this->isInitialized) {
         return;
     }
     // Special case for PostgreSQL inserts -- we need to provide an extra
     // clue so that the database knows how to write bytea data correctly:
     if ($this->adapter->getDriver()->getDatabasePlatformName() == "Postgresql") {
         if (!is_object($this->featureSet)) {
             $this->featureSet = new Feature\FeatureSet();
         }
         $eventFeature = new Feature\EventFeature();
         $eventFeature->getEventManager()->attach(Feature\EventFeature::EVENT_PRE_INSERT, [$this, 'onPreInsert']);
         $this->featureSet->addFeature($eventFeature);
     }
     parent::initialize();
 }
示例#2
0
 public function getServiceConfig()
 {
     return array('factories' => array('Cache\\Adapter\\MemcachedOptions' => function ($sm) {
         $config = $sm->get('config');
         return new MemcachedOptions($config['memcached']);
     }, 'Cache\\Adapter\\Memcached' => function ($sm) {
         return new Memcached($sm->get('Cache\\Adapter\\MemcachedOptions'));
     }, "Application\\Listener\\MemcachedListener" => function ($sm) {
         $memcached = $sm->get('Cache\\Adapter\\Memcached');
         $cacheListener = new MemcachedListener($memcached);
         return $cacheListener;
     }, 'Zend\\EventManager\\EventManager' => function ($sm) {
         $eventManager = new EventManager();
         return $eventManager;
     }), 'initializers' => array('EventFeatureCacheAwareInterface' => function ($model, $serviceLocator) {
         if ($model instanceof EventFeatureCacheAwareInterface) {
             $logListener = $serviceLocator->get('Security\\Listener\\LogListener');
             $eventFeature = new EventFeature();
             $eventFeature->getEventManager()->attachAggregate($logListener);
             $model->setEventFeatureCache($eventFeature);
         }
     }));
 }
示例#3
0
 public function testGetEventManager()
 {
     $this->assertSame($this->eventManager, $this->feature->getEventManager());
 }