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


PHP xPDOObject::getOne方法代碼示例

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


在下文中一共展示了xPDOObject::getOne方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

 /**
  * Returns related modElement instances based on the element_class column.
  *
  * {@inheritdoc}
  */
 public function &getOne($alias, $criteria = null, $cacheFlag = true)
 {
     if ($alias == 'Element') {
         $criteria = $this->xpdo->newQuery($this->get('element_class'), $criteria);
     }
     $object = parent::getOne($alias, $criteria, $cacheFlag);
     return $object;
 }
開發者ID:JoeBlow,項目名稱:revolution,代碼行數:13,代碼來源:modelementpropertyset.class.php

示例2: prepareRow

 function prepareRow(xPDOObject $object)
 {
     /** @var byAd $ad */
     $ad = $object->getOne('Ad');
     $row = array_merge($ad->toArray(), $object->toArray());
     $row['image'] = $ad->getImageUrl();
     return $row;
 }
開發者ID:suasti,項目名稱:BannerY,代碼行數:8,代碼來源:getlist.class.php

示例3: sendNotice

 /** @inheritdoc} */
 public function sendNotice(xPDOObject $instance, $status = 0)
 {
     $this->modx->log(1, print_r('sendNotice sendNotice', 1));
     if (!$status) {
         $status = $instance->getOne('Status');
     } else {
         $status = $this->modx->getObject('MlmSystemStatus', $status);
     }
     if (!$status or !$this->MlmSystem->getOption('mail_notice', null, false)) {
         return false;
     }
     /* get context */
     if (!($context = $instance->get('context'))) {
         $context = !$this->modx->context->key || $this->modx->context->key == 'mgr' ? 'web' : $this->modx->context->key;
     }
     /* get users */
     $user = array();
     switch (true) {
         case $instance instanceof MlmSystemClient:
             $user[] = $instance->get('id');
             break;
         default:
             break;
     }
     $pls = array('listUser' => '', 'listEmail' => '', 'subjectEmail' => '', 'bodyEmail' => '', 'queueEmail' => false, 'getUser' => false, 'formatField' => true, 'fastMode' => true, 'context' => $context, 'addPls' => array());
     if ($status->get('email_user')) {
         if ($chunk = $this->modx->getObject('modChunk', $status->get('tpl_user'))) {
             $plsWork = $pls;
             $plsWork['listUser'] = implode(',', $user);
             if ($properties = $chunk->getProperties()) {
                 foreach ($properties as $k => $v) {
                     if (!isset($plsWork[$k])) {
                         $plsWork[$k] = $v;
                     } elseif (is_string($plsWork[$k]) and !empty($plsWork[$k])) {
                         $plsWork[$k] .= ',' . $v;
                     } elseif (is_string($plsWork[$k]) and empty($plsWork[$k])) {
                         $plsWork[$k] = $v;
                     } elseif (is_array($plsWork[$k])) {
                         $plsWork[$k] = array_merge($this->modx->fromJSON($v), $plsWork[$k]);
                     } elseif (is_bool($plsWork[$k])) {
                         $plsWork[$k] = $v;
                     }
                 }
             }
             $plsWork['addPls'] = array_merge($plsWork['addPls'], $this->processObject($instance, (int) $plsWork['formatField']));
             $this->runProcessor('mgr/email/send', $plsWork);
         }
     }
     if ($status->get('email_manager')) {
         if ($chunk = $this->modx->getObject('modChunk', $status->get('tpl_manager'))) {
             $plsWork = $pls;
             $plsWork['listEmail'] = $this->MlmSystem->getOption('email_manager', null, $this->modx->getOption('emailsender'));
             if ($properties = $chunk->getProperties()) {
                 foreach ($properties as $k => $v) {
                     if (!isset($plsWork[$k])) {
                         $plsWork[$k] = $v;
                     } elseif (is_string($plsWork[$k]) and !empty($plsWork[$k])) {
                         $plsWork[$k] .= ',' . $v;
                     } elseif (is_string($plsWork[$k]) and empty($plsWork[$k])) {
                         $plsWork[$k] = $v;
                     } elseif (is_array($plsWork[$k])) {
                         $plsWork[$k] = array_merge($this->modx->fromJSON($v), $plsWork[$k]);
                     } elseif (is_bool($plsWork[$k])) {
                         $plsWork[$k] = $v;
                     }
                 }
             }
             $plsWork['addPls'] = array_merge($plsWork['addPls'], $this->processObject($instance, (int) $plsWork['formatField']));
             $this->runProcessor('mgr/email/send', $plsWork);
         }
     }
     return true;
 }
開發者ID:vgrish,項目名稱:mlmsystem,代碼行數:74,代碼來源:systemtools.class.php


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