當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。