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


PHP ZMObject::setId方法代码示例

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


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

示例1: onViewStart

 /**
  * Add custom view data.
  */
 public function onViewStart($event)
 {
     $request = $event->getArgument('request');
     $translator = $this->container->get('translator');
     if ($this->handleRequest($request->getRequestId())) {
         // create sources list
         $howDidYouHearSources = array();
         $source = new ZMObject();
         $source->setId('');
         $source->setName($translator->trans('Please select a source'));
         $howDidYouHearSources[] = $source;
         $sql = "SELECT sources_id, sources_name\n                    FROM %table.sources%\n                    ORDER BY sources_name";
         foreach (\ZMRuntime::getDatabase()->fetchAll($sql, array()) as $result) {
             $source = new ZMObject();
             $source->setId($result['sources_id']);
             $source->setName($result['sources_name']);
             $howDidYouHearSources[] = $source;
         }
         if ($this->isDisplayOther()) {
             $source = new ZMObject();
             $source->setId(ID_SOURCE_OTHER);
             $source->setName($translator->trans('Other - (please specify)'));
             $howDidYouHearSources[] = $source;
         }
         // create reliable form reference
         if (null != ($view = $event->getArgument('view')) && $view instanceof TemplateView) {
             $view->setVariable('howDidYouHearSources', $howDidYouHearSources);
             if (null != ($registration = $view->getVariable('registration'))) {
                 $view->setVariable('howDidYouHearForm', $registration);
             } elseif (null != ($shippingAddress = $view->getVariable('shippingAddress'))) {
                 // if we have an address we should have got the source as well...
                 $account = $this->container->get('security.context')->getToken()->getUser();
                 $addressList = $this->container->get('addressService')->getAddressesForAccountId($account->getId());
                 if ($this->isEnableOnGuestCheckout() && Account::GUEST == $account->getType() && 0 == count($addressList)) {
                     $view->setVariable('howDidYouHearForm', $shippingAddress);
                 }
             }
         }
     }
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:43,代码来源:HowDidYouHearPlugin.php


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