当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::getParam方法代码示例

本文整理汇总了PHP中Zend\EventManager\Event::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::getParam方法的具体用法?PHP Event::getParam怎么用?PHP Event::getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\EventManager\Event的用法示例。


在下文中一共展示了Event::getParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onFetch

    /**
     * Determine if the given entity is DB-connected, and, if so, recast to a DbConnectedRestServiceEntity
     *
     * @param  \Zend\EventManager\Event $e
     * @return null|DbConnectedRestServiceEntity
     */
    public static function onFetch($e)
    {
        $entity = $e->getParam('entity', false);
        if (!$entity) {
            // No entity; nothing to do
            return;
        }

        $config = $e->getParam('config', array());
        if (!isset($config['zf-apigility'])
            || !isset($config['zf-apigility']['db-connected'])
            || !isset($config['zf-apigility']['db-connected'][$entity->resourceClass])
        ) {
            // No DB-connected configuration for this service; nothing to do
            return;
        }
        $config = $config['zf-apigility']['db-connected'][$entity->resourceClass];

        if (!isset($config['table_service'])) {
            $config['table_service'] = sprintf('%s\\Table', $entity->resourceClass);
        }

        $dbConnectedEntity = new DbConnectedRestServiceEntity();
        $dbConnectedEntity->exchangeArray(array_merge($entity->getArrayCopy(), $config));

        // If no override resource class is present, remove it from the returned entity
        if ($e->getParam('fetch', true) && ! isset($config['resource_class'])) {
            $dbConnectedEntity->exchangeArray(array('resource_class' => null));
        }

        return $dbConnectedEntity;
    }
开发者ID:jbarentsen,项目名称:drb,代码行数:38,代码来源:DbConnectedRestServiceModel.php

示例2: __invoke

 /**
  * @param array|null $resource
  * @param Request    $request
  * @param Response   $response
  */
 public function __invoke(Event $event)
 {
     $resource = $event->getParam('resource');
     $response = $event->getParam('response');
     $body = $this->renderView($resource, $response);
     $response->setBody($body);
 }
开发者ID:comphppuebla,项目名称:restful-extensions,代码行数:12,代码来源:RenderResourceListener.php

示例3: onStart

 /**
  * Gets executed on 'start'
  *
  * @param Event $e
  * @return void
  */
 public function onStart(Event $e)
 {
     $instance = $e->getParam('instance');
     $discussion = $e->getParam('discussion');
     $params = [['name' => 'on', 'value' => $e->getParam('on')]];
     $this->logEvent('discussion/create', $instance, $discussion, $params);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:13,代码来源:DiscussionManagerListener.php

示例4: onReject

 public function onReject(Event $e)
 {
     $revision = $e->getParam('revision');
     $repository = $e->getParam('repository');
     $instance = $repository->getInstance();
     $reason = $e->getParam('reason');
     $this->logEvent('entity/revision/reject', $instance, $revision, [['name' => 'repository', 'value' => $repository], ['name' => 'reason', 'value' => $reason]]);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:8,代码来源:RepositoryManagerListener.php

示例5: onUnLink

 public function onUnLink(Event $e)
 {
     $entity = $e->getParam('entity');
     $user = $this->getUserManager()->getUserFromAuthenticator();
     $instance = $this->getInstanceManager()->getInstanceFromRequest();
     $params = [['name' => 'parent', 'value' => $e->getParam('parent')]];
     $this->logEvent('entity/link/remove', $instance, $entity, $params);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:8,代码来源:LinkServiceListener.php

示例6: onCreate

 public function onCreate(Event $e)
 {
     $entity = $e->getParam('entity');
     $data = $e->getParam('data');
     if (array_key_exists('taxonomy', $data)) {
         $options = $data['taxonomy'];
         $this->getTaxonomyManager()->associateWith($options['term'], $entity);
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:9,代码来源:EntityManagerListener.php

示例7: onUpdate

 /**
  * Gets executed on page create
  *
  * @param Event $e
  * @return void
  */
 public function onUpdate(Event $e)
 {
     /* @var $repository PageRepositoryInterface */
     $slug = $e->getParam('slug');
     $repository = $e->getParam('repository');
     $url = $e->getTarget()->url()->fromRoute('page/view', ['page' => $repository->getId()], null, null, false);
     $alias = $this->getAliasManager()->createAlias($url, $slug, $slug . '-' . $repository->getId(), $repository, $repository->getInstance());
     $this->getAliasManager()->flush($alias);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:15,代码来源:PageControllerListener.php

示例8: onDissociate

 public function onDissociate(Event $e)
 {
     /* @var $term TaxonomyTermInterface */
     $term = $e->getParam('term');
     $object = $e->getParam('object');
     if ($object instanceof TaxonomyTermAwareInterface && $object instanceof UuidInterface) {
         $this->removeMetadata($object, $term);
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:9,代码来源:TaxonomyManagerListener.php

示例9: onCreateFile

 /**
  * @param Event $params
  */
 public function onCreateFile(Event $params)
 {
     $file = $params->getParam('file');
     if (!$file instanceof ImageInterface) {
         return;
     }
     $fileInfoArray = $params->getParam('fileInfoArray');
     list($width, $height) = getimagesize($fileInfoArray['tmp_name']);
     $file->setWidth($width)->setHeight($height);
 }
开发者ID:coolms,项目名称:image,代码行数:13,代码来源:ImageUploadListener.php

示例10: initializeView

 public function initializeView(Event $e)
 {
     $app = $e->getParam('application');
     $locator = $app->getLocator();
     $config = $e->getParam('modules')->getMergedConfig();
     $view = $this->getView($app, $config);
     $viewListener = $this->getViewListener($view, $config);
     $app->events()->attachAggregate($viewListener);
     $events = StaticEventManager::getInstance();
     $viewListener->registerStaticListeners($events, $locator);
 }
开发者ID:bb-drummer,项目名称:Zcmf,代码行数:11,代码来源:Module.php

示例11: onDispatchDirect

 /**
  * Perform an ACL check when a AuthorizedDirectObject is dispatched.
  *
  * @param \Zend\Mvc\MvcEvent $event
  * @return null|array
  */
 public function onDispatchDirect(Event $event)
 {
     $object = $event->getParam('object');
     $method = $event->getParam('rpc')->getMethod();
     // Check ACL
     if ($object instanceof \JaztecAcl\Direct\AuthorizedDirectObject) {
         if (!$object->checkAcl($method)) {
             $event->stopPropagation(true);
             return $object->notAllowed();
         }
     }
 }
开发者ID:jaztec,项目名称:jaztec-acl,代码行数:18,代码来源:Module.php

示例12: onCreateFile

 /**
  * @param Event $params
  */
 public function onCreateFile(Event $params)
 {
     /* @var $file FileInterface */
     $file = $params->getParam('file');
     $fileInfoArray = $params->getParam('fileInfoArray');
     $pathGenerator = $params->getParam('pathGenerator');
     $pathGenerator = $pathGenerator ? $this->normalizePathGenerator($pathGenerator) : $this->getDefaultPathGenerator();
     $path = $this->getPath($pathGenerator, $file);
     $folder = $this->getUploadFolderByPath($path);
     $file->setFolder($folder);
     $file->setBasename($fileInfoArray['name']);
 }
开发者ID:coolms,项目名称:file,代码行数:15,代码来源:AbstractUploadableManager.php

示例13: onStartSubscribe

 public function onStartSubscribe(Event $e)
 {
     if (isset($e->getParam('data')['subscription'])) {
         $params = $e->getParam('data');
         $param = $params['subscription'];
         if ($param['subscribe'] === '1') {
             $user = $e->getParam('author');
             $discussion = $e->getParam('discussion');
             $notifyMailman = $param['mailman'] === '1' ? true : false;
             $this->subscribe($user, $discussion, $notifyMailman);
         }
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:13,代码来源:DiscussionManagerListener.php

示例14: onCommitRevision

 public function onCommitRevision(Event $e)
 {
     $repository = $e->getParam('repository');
     $data = $e->getParam('data');
     $user = $e->getParam('author');
     foreach ($data as $params) {
         if (is_array($params) && array_key_exists('subscription', $params)) {
             $param = $params['subscription'];
             if ($param['subscribe'] === '1') {
                 $notifyMailman = $param['mailman'] === '1' ? true : false;
                 $this->subscribe($user, $repository, $notifyMailman);
             }
         }
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:15,代码来源:RepositoryManagerListener.php

示例15: updateSchema

 /**
  * {@inheritDoc}
  */
 public function updateSchema(Event $e)
 {
     $moduleVersion = $e->getParam('version');
     // Set extra model
     $extraModel = Pi::model('extra', $this->module);
     $extraTable = $extraModel->getTable();
     $extraAdapter = $extraModel->getAdapter();
     // Set news story model
     $newsStoryModel = Pi::model('story', 'news');
     $newsStoryTable = $newsStoryModel->getTable();
     $newsStoryAdapter = $newsStoryModel->getAdapter();
     // Update to version 0.1.5
     if (version_compare($moduleVersion, '0.1.5', '<')) {
         // Update value
         $select = $extraModel->select();
         $rowSet = $extraModel->selectWith($select);
         foreach ($rowSet as $row) {
             // Set time
             $time = $row->time_end ? $row->time_end : $row->time_start;
             // Update time_publish
             $newsStoryModel->update(array('time_publish' => $time), array('id' => $row->id));
         }
     }
     // Update to version 0.4.1
     if (version_compare($moduleVersion, '0.4.1', '<')) {
         // Alter table field `register_discount`
         $sql = sprintf("ALTER TABLE %s ADD `register_discount` TEXT", $extraTable);
         try {
             $extraAdapter->query($sql, 'execute');
         } catch (\Exception $exception) {
             $this->setResult('db', array('status' => false, 'message' => 'Table alter query failed: ' . $exception->getMessage()));
             return false;
         }
     }
 }
开发者ID:pi-module,项目名称:event,代码行数:38,代码来源:Update.php


注:本文中的Zend\EventManager\Event::getParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。