本文整理汇总了PHP中RedBeanModelDataProvider::makeWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBeanModelDataProvider::makeWhere方法的具体用法?PHP RedBeanModelDataProvider::makeWhere怎么用?PHP RedBeanModelDataProvider::makeWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanModelDataProvider
的用法示例。
在下文中一共展示了RedBeanModelDataProvider::makeWhere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preFilter
protected function preFilter($filterChain)
{
if (isset($_POST['ajax'])) {
return true;
}
$modelClassName = $this->modelClassName;
if ($modelClassName == null) {
$modelClassName = $this->controller->getModule()->getPrimaryModelName();
}
if ($this->stateMetadataAdapterClassName != null) {
$stateClassName = $this->stateMetadataAdapterClassName;
$metadata = array('clauses' => array(), 'structure' => '');
$stateMetadataAdapter = new $stateClassName($metadata);
$metadata = $stateMetadataAdapter->getAdaptedDataProviderMetadata();
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter($modelClassName);
$where = RedBeanModelDataProvider::makeWhere($modelClassName, $metadata, $joinTablesAdapter);
} else {
$joinTablesAdapter = null;
$where = null;
}
if ($modelClassName::getCount($joinTablesAdapter, $where) != 0) {
return true;
}
$messageViewClassName = $this->getMessageViewClassName();
if ($messageViewClassName == null) {
$messageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'ZeroModelsYetView';
}
$messageView = new $messageViewClassName($this->resolveMessageControllerId(), $this->resolveMessageModuleId(), $modelClassName);
$this->resolveAndRenderView($messageView);
return false;
}
示例2: getUnreadCountForCurrentUser
public function getUnreadCountForCurrentUser()
{
$searchAttributeData = $this->getMetadataForUnreadForCurrentUser();
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Mission');
$where = RedBeanModelDataProvider::makeWhere('Mission', $searchAttributeData, $joinTablesAdapter);
return Mission::getCount($joinTablesAdapter, $where, 'Mission', true);
}
示例3: getReportsByPartialName
/**
* @param $partialName
* @param $pageSize
* @param null|string $moduleClassName
* @param null|string $type
* @return Array of SavedReport models
*/
public static function getReportsByPartialName($partialName, $pageSize, $moduleClassName = null, $type = null)
{
assert('is_string($partialName)');
assert('is_int($pageSize)');
assert('is_string($moduleClassName) || $moduleClassName == null');
assert('is_string($type) || $type == null');
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'name', 'operatorType' => 'contains', 'value' => $partialName));
$clauseCount = 2;
if ($moduleClassName != null) {
$searchAttributeData['clauses'][$clauseCount] = array('attributeName' => 'moduleClassName', 'operatorType' => 'equals', 'value' => $moduleClassName);
$clauseCount++;
}
if ($type != null) {
$searchAttributeData['clauses'][$clauseCount] = array('attributeName' => 'type', 'operatorType' => 'equals', 'value' => $type);
}
if ($clauseCount == 1) {
$searchAttributeData['structure'] = '(1)';
} elseif ($clauseCount == 2) {
$searchAttributeData['structure'] = '(1 and 2)';
} else {
$searchAttributeData['structure'] = '(1 and 2 and 3)';
}
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('SavedReport');
$where = RedBeanModelDataProvider::makeWhere('SavedReport', $searchAttributeData, $joinTablesAdapter);
return SavedReport::getSubset($joinTablesAdapter, null, $pageSize, $where, 'name');
}
示例4: getEmailTemplatesByPartialName
/**
* @param $partialName
* @param $pageSize
* @param null|string $moduleClassName
* @param null|string $type
* @return Array of SavedReport models
*/
public static function getEmailTemplatesByPartialName($partialName, $pageSize, $modelClassName = null, $type = null)
{
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'type', 'operatorType' => 'equals', 'value' => intval($type)), 2 => array('attributeName' => 'modelClassName', 'operatorType' => 'equals', 'value' => $modelClassName), 3 => array('attributeName' => 'isDraft', 'operatorType' => 'equals', 'value' => intval(false)), 4 => array('attributeName' => 'name', 'operatorType' => 'contains', 'value' => $partialName));
$searchAttributeData['structure'] = '1 and 2 and 3 and 4';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('EmailTemplate');
$where = RedBeanModelDataProvider::makeWhere('EmailTemplate', $searchAttributeData, $joinTablesAdapter);
return EmailTemplate::getSubset($joinTablesAdapter, null, $pageSize, $where, 'name');
}
示例5: getIdsByUsersMemberOfGroup
public static function getIdsByUsersMemberOfGroup($groupId)
{
$groupId = intval($groupId);
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'users', 'relatedModelData' => array('attributeName' => 'groups', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $groupId)));
$searchAttributeData['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter(get_called_class());
$where = RedBeanModelDataProvider::makeWhere(get_called_class(), $searchAttributeData, $joinTablesAdapter);
return static::getSubsetIds($joinTablesAdapter, null, null, $where);
}
示例6: getAccountsByPartialName
/**
* For a given partialName, run search by partial name and retrieve account models.
* @param string $partialName
* @param null|int $pageSize
*/
public static function getAccountsByPartialName($partialName, $pageSize = null)
{
assert('is_string($partialName)');
$metadata = array();
$metadata['clauses'] = array(1 => array('attributeName' => 'name', 'operatorType' => 'contains', 'value' => $partialName));
$metadata['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Account');
$where = RedBeanModelDataProvider::makeWhere('Account', $metadata, $joinTablesAdapter);
return Account::getSubset($joinTablesAdapter, null, $pageSize, $where);
}
示例7: getAccountsByAnyEmailAddress
/**
* For a given email address, run search by email address and retrieve account models.
*/
public static function getAccountsByAnyEmailAddress($emailAddress, $pageSize = null)
{
assert('is_string($emailAddress)');
$metadata = array();
$metadata['clauses'] = array(1 => array('attributeName' => 'primaryEmail', 'relatedAttributeName' => 'emailAddress', 'operatorType' => 'equals', 'value' => $emailAddress), 2 => array('attributeName' => 'secondaryEmail', 'relatedAttributeName' => 'emailAddress', 'operatorType' => 'equals', 'value' => $emailAddress));
$metadata['structure'] = '(1 or 2)';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Account');
$where = RedBeanModelDataProvider::makeWhere('Account', $metadata, $joinTablesAdapter);
return Account::getSubset($joinTablesAdapter, null, $pageSize, $where);
}
示例8: getByType
/**
* @param string $type
* @param null|int $pageSize
*/
public static function getByType($type, $pageSize = null)
{
assert('is_string($type)');
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'type', 'operatorType' => 'equals', 'value' => $type));
$searchAttributeData['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter(get_called_class());
$where = RedBeanModelDataProvider::makeWhere(get_called_class(), $searchAttributeData, $joinTablesAdapter);
return self::getSubset($joinTablesAdapter, null, $pageSize, $where, null);
}
示例9: getCountByUser
public static function getCountByUser(User $user)
{
assert('$user->id > 0');
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'owner', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $user->id));
$searchAttributeData['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Notification');
$where = RedBeanModelDataProvider::makeWhere('Notification', $searchAttributeData, $joinTablesAdapter);
return self::getCount($joinTablesAdapter, $where, null, true);
}
示例10: getAllByFolderType
public static function getAllByFolderType($type)
{
assert('is_string($type)');
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'folder', 'relatedAttributeName' => 'type', 'operatorType' => 'equals', 'value' => $type));
$searchAttributeData['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('EmailMessage');
$where = RedBeanModelDataProvider::makeWhere('EmailMessage', $searchAttributeData, $joinTablesAdapter);
return self::getSubset($joinTablesAdapter, null, null, $where, null);
}
示例11: getAllByUser
/**
* Given a user, retrieval all notifications for that user, sorted desc by Id
* @param User $user
*/
public static function getAllByUser(User $user)
{
assert('$user->id > 0');
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'user', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $user->id));
$searchAttributeData['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('GameNotification');
$where = RedBeanModelDataProvider::makeWhere('GameNotification', $searchAttributeData, $joinTablesAdapter);
$models = self::getSubset($joinTablesAdapter, null, null, $where, 'gamenotification.id asc');
return $models;
}
示例12: getByOwnerAndViewClassName
/**
* @param User $user
* @param string $viewClassName
*/
public static function getByOwnerAndViewClassName(User $user, $viewClassName)
{
assert('$user->id > 0');
assert('is_string($viewClassName)');
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'owner', 'operatorType' => 'equals', 'value' => $user->id), 2 => array('attributeName' => 'viewClassName', 'operatorType' => 'equals', 'value' => $viewClassName));
$searchAttributeData['structure'] = '1 and 2';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('SavedSearch');
$where = RedBeanModelDataProvider::makeWhere('SavedSearch', $searchAttributeData, $joinTablesAdapter);
return self::getSubset($joinTablesAdapter, null, null, $where, null);
}
示例13: getModelsToProcess
/**
* @param $pageSize
* @return array of WorkflowMessageInQueue models
*/
public static function getModelsToProcess($pageSize)
{
assert('is_int($pageSize)');
$timeStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'processDateTime', 'operatorType' => 'lessThan', 'value' => $timeStamp));
$searchAttributeData['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('WorkflowMessageInQueue');
$where = RedBeanModelDataProvider::makeWhere('WorkflowMessageInQueue', $searchAttributeData, $joinTablesAdapter);
return self::getSubset($joinTablesAdapter, null, $pageSize, $where, null);
}
示例14: getModelsTResolveToJobQueue
public static function getModelsTResolveToJobQueue($pageSize, $offset, $modelClassName, $timeStamp)
{
assert('is_int($pageSize) || $pageSize == null');
assert('is_int($offset)');
assert('is_string($modelClassName)');
assert('is_int($timeStamp)');
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'processDateTime', 'operatorType' => 'greaterThan', 'value' => DateTimeUtil::convertTimestampToDbFormatDateTime($timeStamp)));
$searchAttributeData['structure'] = '1';
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter($modelClassName);
$where = RedBeanModelDataProvider::makeWhere($modelClassName, $searchAttributeData, $joinTablesAdapter);
return $modelClassName::getSubset($joinTablesAdapter, $offset, $pageSize, $where, null);
}
示例15: deleteRelatedFileContentIfNotRelatedToAnyOtherFileModel
protected function deleteRelatedFileContentIfNotRelatedToAnyOtherFileModel()
{
$searchAttributeData = array();
$searchAttributeData['clauses'] = array(1 => array('attributeName' => 'fileContent', 'relatedModelData' => array('attributeName' => 'id', 'operatorType' => 'equals', 'value' => $this->fileContent->id)));
$searchAttributeData['structure'] = '1';
$class = get_class($this);
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter($class);
$where = RedBeanModelDataProvider::makeWhere($class, $searchAttributeData, $joinTablesAdapter);
if (static::getCount($joinTablesAdapter, $where, $class) == 1) {
return $this->fileContent->delete();
}
return true;
}