本文整理汇总了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;
}
示例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;
}
示例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;
}