當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ZMObject::setName方法代碼示例

本文整理匯總了PHP中ZenMagick\Base\ZMObject::setName方法的典型用法代碼示例。如果您正苦於以下問題:PHP ZMObject::setName方法的具體用法?PHP ZMObject::setName怎麽用?PHP ZMObject::setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ZenMagick\Base\ZMObject的用法示例。


在下文中一共展示了ZMObject::setName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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

示例2: testCreateMappedObjSQL

 /**
  * Test create mapped SQL using obj.
  */
 public function testCreateMappedObjSQL()
 {
     $obj = new ZMObject();
     $obj->setName('foo4');
     $obj->setClassName('class4');
     $obj->setMethodName('method4');
     $obj->setParameterList('parameter4');
     $this->registerTableMapping();
     $sql = "INSERT INTO %table.create_update_tests%\n                (name, class_name, method_name, parameter_list) VALUES\n                (:name, :className, :methodName, :parameterList)";
     foreach (TestDatabase::getProviders() as $provider => $database) {
         $database->updateObj($sql, $obj, 'create_update_tests');
     }
 }
開發者ID:zenmagick,項目名稱:zenmagick,代碼行數:16,代碼來源:CreateUpdateTest.php


注:本文中的ZenMagick\Base\ZMObject::setName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。