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


PHP ZurmoRedBean::load方法代码示例

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


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

示例1: getBean

 public static function getBean(RedBean_OODBBean $bean, $typeName, $name = null)
 {
     $fieldName = self::getLinkField($typeName, $name);
     $id = (int) $bean->{$fieldName};
     if ($id) {
         return ZurmoRedBean::load($typeName, $id);
     } else {
         return null;
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:ZurmoRedBeanLinkManager.php

示例2: getByLayoutIdAndUser

 /**
  * @param int $layoutId
  * @param User $user
  * @throws NotFoundException
  */
 public static function getByLayoutIdAndUser($layoutId, $user)
 {
     assert('is_integer($layoutId) && $layoutId >= 1');
     assert('$user instanceof User && $user->id > 0');
     $sql = 'select dashboard.id id ' . 'from dashboard, ownedsecurableitem ' . 'where ownedsecurableitem.owner__user_id = ' . $user->id . ' and dashboard.ownedsecurableitem_id = ownedsecurableitem.id ' . ' and layoutid = ' . $layoutId . ' order by layoutId;';
     $ids = ZurmoRedBean::getCol($sql);
     assert('count($ids) <= 1');
     if (count($ids) == 0) {
         if ($layoutId == Dashboard::DEFAULT_USER_LAYOUT_ID) {
             return Dashboard::setDefaultDashboardForUser($user);
         }
         throw new NotFoundException();
     }
     $bean = ZurmoRedBean::load(Dashboard::getTableName(), $ids[0]);
     assert('$bean === false || $bean instanceof RedBean_OODBBean');
     if ($bean === false) {
         throw new NotFoundException();
     }
     return self::makeModel($bean);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:25,代码来源:Dashboard.php

示例3: testPDOTypesToShowTheDodginessOfNotBeingAbleToGetNumbersOut

 public function testPDOTypesToShowTheDodginessOfNotBeingAbleToGetNumbersOut()
 {
     $wukka = ZurmoRedBean::dispense('wukka');
     $wukka->integer = 69;
     ZurmoRedBean::store($wukka);
     $id = $wukka->id;
     unset($wukka);
     $pdo = new PDO(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
     // Not Coding Standard
     $statement = $pdo->prepare('select version() as version;');
     $statement->execute();
     $rows = $statement->fetchAll();
     $mysqlVersion = substr($rows[0]['version'], 0, 3);
     $phpVersion = substr(phpversion(), 0, 5);
     // These is what we are interested in. They seem to be ignored in
     // php 5.3 with mysql 5.1, but works in php 5.3.6 & mysql 5.5.
     // Both are needed to be set false.
     // Whether it is the newer php version or the newer mysql version
     // or both together, and at exactly which versions it works is
     // unknown. That is for some future investigation.
     $pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
     $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
     $wukka = ZurmoRedBean::load('wukka', $id);
     $statement = $pdo->prepare('select * from wukka;');
     $statement->execute();
     $rows = $statement->fetchAll();
     if (($phpVersion == '5.3.6' || $phpVersion == '5.3.5' || $phpVersion == '5.5.2') && $mysqlVersion == '5.5') {
         $this->assertEquals('integer', gettype($rows[0]['integer']));
         // Good! This is what we want!!!
         $this->assertEquals('string', gettype($wukka->integer));
         // Dodgy!!!
     } else {
         $this->assertEquals('string', gettype($rows[0]['integer']));
         // Dodgy!!!
         $this->assertEquals('string', gettype($wukka->integer));
         // Dodgy!!!
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:38,代码来源:PDOTest.php

示例4: makeModelsBySql

 /**
  * Given a unioned sql statement, make the models for the beans returned.  The modelClassName is a column
  * name that must be in the select part of the sql statement for each unioned select.
  * @param string $sql
  * @return array of models
  */
 protected function makeModelsBySql($sql)
 {
     assert('is_string($sql)');
     $models = array();
     $idsAndModelClassNames = ZurmoRedBean::getAll($sql);
     foreach ($idsAndModelClassNames as $data) {
         $modelClassName = $data['modelClassName'];
         $tableName = $modelClassName::getTableName();
         $bean = ZurmoRedBean::load($tableName, $data['id']);
         $models[] = $modelClassName::makeModel($bean, $modelClassName);
     }
     return $models;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:19,代码来源:RedBeanModelsDataProvider.php

示例5: testCascadedDeleteDoesNotWorkForLinkedBeans

 public function testCascadedDeleteDoesNotWorkForLinkedBeans()
 {
     $member = ZurmoRedBean::dispense('marketinglistmember');
     $member->unsubscribed = true;
     ZurmoRedBean::store($member);
     $list = ZurmoRedBean::dispense('marketinglist');
     $list->name = 'dummy';
     ZurmoRedBean::store($list);
     ZurmoRedBeanLinkManager::link($member, $list);
     ZurmoRedBean::store($member);
     $id = $list->id;
     unset($list);
     ZurmoRedBean::trash($member);
     unset($member);
     $list = ZurmoRedBean::load('marketinglist', $id);
     $this->assertNotNull($list);
     // The list is not deleted.
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:RedBeanTest.php


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