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


PHP ZurmoRedBean::find方法代码示例

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


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

示例1: getModelByExternalSystemIdAndModelClassName

 /**
  * Given an external system id and model class name, try to find the associated model if it exists. If it is
  * not found, a NotFoundException will be thrown.  Otherwise the model will be made and returned.
  * @param string $id
  * @param string $modelClassName
  * @return RedBeanModel $model
  * @throws NotFoundException
  */
 public static function getModelByExternalSystemIdAndModelClassName($id, $modelClassName)
 {
     assert('$id != null && is_string($id)');
     assert('is_string($modelClassName)');
     $tableName = $modelClassName::getTableName();
     $beans = ZurmoRedBean::find($tableName, ExternalSystemIdUtil::EXTERNAL_SYSTEM_ID_COLUMN_NAME . " = '{$id}'");
     assert('count($beans) <= 1');
     if (count($beans) == 0) {
         throw new NotFoundException();
     }
     return RedBeanModel::makeModel(end($beans), $modelClassName);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:ExternalSystemIdSuppportedSanitizerUtil.php

示例2: getSinceDateTime

 public static function getSinceDateTime($dateTime)
 {
     assert('DateTimeUtil::isValidDbFormattedDateTime($dateTime)');
     return self::makeModels($beans = ZurmoRedBean::find('auditevent', "datetime >= '{$dateTime}'"));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:5,代码来源:AuditEvent.php

示例3: getByModuleName

 /**
  * Gets all of the configuration entries for a module.
  * @param $user id
  * @return An array of arrays, keyed first on the module names, and
  * then the entry keys.
  */
 public static function getByModuleName($userId, $moduleName)
 {
     assert('$userId != null && is_int($userId)');
     assert('$moduleName != ""');
     $beans = ZurmoRedBean::find(UserConfiguration::getTableName(), "userId = {$userId} and moduleName = '{$moduleName}'");
     $moduleEntries = array();
     foreach ($beans as $bean) {
         if (!isset($moduleEntries[$bean->moduleName])) {
             $moduleEntries[$bean->moduleName] = array();
         }
         $moduleEntries[$bean->moduleName][$bean->key] = $bean->value;
     }
     return $moduleEntries;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:UserConfiguration.php

示例4: constructRelatedBeansAndModels

 /**
  * Handles constructing the relatedBeansAndModels with special attention to the case where it is PolyOneToMany
  * @param string $modelClassName
  * @param mixed $sqlOrBean
  */
 private function constructRelatedBeansAndModels($modelClassName, $sqlOrBean = '')
 {
     assert('is_string($sqlOrBean) || $sqlOrBean instanceof RedBean_OODBBean');
     $tableName = $modelClassName::getTableName();
     if (is_string($sqlOrBean)) {
         $this->relatedBeansAndModels = array_values($beans = ZurmoRedBean::find($tableName, $sqlOrBean));
     } else {
         assert('$sqlOrBean instanceof RedBean_OODBBean');
         $this->bean = $sqlOrBean;
         try {
             if ($this->bean->id > 0) {
                 if ($this->linkType == RedBeanModel::LINK_TYPE_POLYMORPHIC) {
                     $value = array();
                     $values['id'] = $this->bean->id;
                     $values['type'] = $this->bean->getMeta('type');
                     $this->relatedBeansAndModels = array_values(ZurmoRedBean::find($tableName, strtolower($this->linkName) . '_id = :id AND ' . strtolower($this->linkName) . '_type = :type', $values));
                 } else {
                     $relatedIds = ZurmoRedBeanLinkManager::getKeys($this->bean, $tableName, $this->resolveLinkNameForCasing());
                     $this->relatedBeansAndModels = array_values(ZurmoRedBean::batch($tableName, $relatedIds));
                 }
             } else {
                 $this->relatedBeansAndModels = array();
             }
         } catch (RedBean_Exception_SQL $e) {
             // SQLSTATE[42S02]: Base table or view not found...
             // SQLSTATE[42S22]: Column not found...
             if (!in_array($e->getSQLState(), array('42S02', '42S22'))) {
                 throw $e;
             }
             $this->relatedBeansAndModels = array();
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:38,代码来源:RedBeanOneToManyRelatedModels.php

示例5: getByHashIndex

 /**
  * @param string $hashIndex row identifier for ContactWebFormEntry
  * @return array of module class names and display labels.
  */
 public static function getByHashIndex($hashIndex)
 {
     $modelClassName = get_called_class();
     $tableName = $modelClassName::getTableName();
     $columnName = self::getColumnNameByAttribute('hashIndex');
     $beans = ZurmoRedBean::find($tableName, "{$columnName} = '{$hashIndex}'");
     assert('count($beans) <= 1');
     if (count($beans) == 0) {
         return null;
     } else {
         return static::makeModel(end($beans), $modelClassName);
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:17,代码来源:ContactWebFormEntry.php

示例6: getDeptRefById

 public static function getDeptRefById($id)
 {
     return self::makeModels(ZurmoRedBean::find('departmentreference', "id =:id", array(':id' => $id)));
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:4,代码来源:DepartmentReference.php

示例7: getByRelatedClassId

 protected static function getByRelatedClassId($relatedModelClassName, $id, $modelClassName = null)
 {
     assert('is_string($relatedModelClassName)');
     assert('$relatedModelClassName != ""');
     assert('is_int($id)');
     //assert('$id > 0');
     assert('$modelClassName === null || is_string($modelClassName) && $modelClassName != ""');
     if ($modelClassName === null) {
         $modelClassName = get_called_class();
     }
     $tableName = $relatedModelClassName::getTableName();
     $foreignKeyName = strtolower($modelClassName) . '_id';
     $beans = ZurmoRedBean::find($tableName, "{$foreignKeyName} = {$id}");
     return self::makeModels($beans, $relatedModelClassName);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:15,代码来源:RedBeanModel.php

示例8: getByName

 public static function getByName($name)
 {
     assert('is_string($name) && $name != ""');
     return self::makeModels(ZurmoRedBean::find('contactstate', "name = :name ", array(':name' => $name)));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:5,代码来源:ContactState.php

示例9: getUnitofmeasureByNameEdit

 public static function getUnitofmeasureByNameEdit($name, $id)
 {
     return self::makeModels(ZurmoRedBean::find('unitofmeasure', "name = :name AND id != :id", array(':name' => $name, ':id' => $id)));
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:4,代码来源:Unitofmeasure.php

示例10: isLanguageADefaultLanguageForAnyUsers

 /**
  * Given a language, is it in use as a default language by any of the users.
  * @param string $language
  * @return true if in use, otherwise returns false.
  */
 protected function isLanguageADefaultLanguageForAnyUsers($language)
 {
     assert('is_string($language)');
     $tableName = User::getTableName();
     $beans = ZurmoRedBean::find($tableName, "language = '{$language}'");
     if (count($beans) > 0) {
         return true;
     }
     return false;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:15,代码来源:ZurmoLanguageHelper.php

示例11: getByCode

 /**
  * Gets a currency by code.
  * @param $code String Code.
  * @return A model of type currency
  */
 public static function getByCode($code)
 {
     assert('is_string($code)');
     $tableName = Currency::getTableName();
     $beans = ZurmoRedBean::find($tableName, "code = '{$code}'");
     assert('count($beans) <= 1');
     if (count($beans) == 0) {
         throw new NotFoundException();
     }
     return static::makeModel(end($beans), 'Currency');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:16,代码来源:Currency.php

示例12: getCategoryByNameEdit

 public static function getCategoryByNameEdit($name, $id)
 {
     return self::makeModels(ZurmoRedBean::find('category', "name = :name AND id != :id", array(':name' => $name, ':id' => $id)));
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:4,代码来源:Category.php

示例13: getProductCode

 /**
  * Returns the display name for the model class.
  * @return dynamic label name based on module.
  */
 public static function getProductCode($productCode)
 {
     return self::makeModels(ZurmoRedBean::find('costbook', "productcode = :productcode ", array(':productcode' => $productCode)));
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:8,代码来源:Costbook.php


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