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


PHP Object::load方法代码示例

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


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

示例1: __construct

 /**
  * Loads the cache file
  *
  * @return void
  * @author Dan Cox
  */
 public function __construct($file = 'module_cache.yml', $services = 'module_services.yml')
 {
     $this->cache = $this->config;
     $this->cache->load(CACHE . $file);
     $this->services = $this->get('config');
     $this->services->load(CACHE . $services);
 }
开发者ID:danzabar,项目名称:alice,代码行数:13,代码来源:ModuleCache.php

示例2: __construct

 /**
  * Set up class vars
  *
  * @return void
  * @author Dan Cox
  */
 public function __construct()
 {
     $this->availableModules = array();
     $this->config = $this->get('config');
     $this->config->load(CONFIG . 'modules.yml');
     $this->getAvailable();
 }
开发者ID:danzabar,项目名称:alice,代码行数:13,代码来源:ModuleLibrary.php

示例3: setUp

 /**
  * Set up test environment
  *
  * @return void
  * @author Dan Cox
  */
 public function setUp()
 {
     $this->database = new Database();
     $this->entity = m::mock('EntityManager');
     $this->connection = new Connection();
     $config = new ConfigFile();
     $config->load(__DIR__ . '/Connections/database_test1.yml');
     $this->connection->load($config);
 }
开发者ID:danzabar,项目名称:alice,代码行数:15,代码来源:DatabaseTest.php

示例4: test_bulkLoad

 /**
  * Bulk loading vars
  *
  * @return void
  * @author Dan Cox
  */
 public function test_bulkLoad()
 {
     $this->params->load(array('bar' => 'foo', 'test' => 'value'));
     $this->assertTrue(isset($this->params->bar));
     $this->assertTrue(isset($this->params->test));
     $this->assertEquals('foo', $this->params->bar);
     $this->assertEquals('value', $this->params->test);
     $this->assertEquals(array('bar' => 'foo', 'test' => 'value'), $this->params->all());
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:15,代码来源:ParamBagTest.php

示例5: loadOrCreate

 /**
  * Loads or creates the file
  *
  * @return void
  * @author Dan Cox
  */
 public function loadOrCreate()
 {
     if ($this->fs->exists(LOGS . $this->file)) {
         $this->config->load(LOGS . $this->file);
     } else {
         $this->config->create(LOGS . $this->file);
         $this->config->params()->created = array('date' => date('Y-m-d H:i:s'));
         $this->config->params()->log = array();
         $this->config->save();
     }
 }
开发者ID:danzabar,项目名称:alice,代码行数:17,代码来源:Log.php

示例6: _getColumnParams

 /**
  * _getColumnParams
  *
  * Retourne les paramètres de la colonne pour la propriété $elmName .
  *
  * @param string $elmName Nom de la propriété.
  * @access private
  * @return array
  */
 private function _getColumnParams($elmName)
 {
     $elmType = $this->getElementType($elmName);
     if ($elmType == Object::TYPE_BOOL) {
         return array('Macro' => '%' . $elmName . '%', 'TranslationMap' => array(false => A_NO, true => A_YES), 'Sortable' => true);
     }
     if ($elmType == Object::TYPE_CONST) {
         $method = sprintf('get%sConstArray', $elmName);
         $arr = call_user_func(array($this->clsname, $method));
         return array('Macro' => '%' . $elmName . '%', 'TranslationMap' => $arr, 'Sortable' => false);
     }
     if ($elmType == Object::TYPE_FKEY) {
         return array('Macro' => '%' . $elmName . '%', 'TranslationMap' => array(0 => 'N/A'), 'Sortable' => true);
     }
     if ($elmType == Object::TYPE_MANYTOMANY) {
         $clsName = $this->links[$elmName]['linkClass'];
         $tmpobject = Object::load($clsName);
         $macro = call_user_func(array($tmpobject, 'getToStringAttribute'));
         if (is_array($macro)) {
             $macro = implode($macro, '% %');
         }
         return array('Macro' => '%' . $macro . '%', 'link' => $elmName, 'Sortable' => true);
     }
     $filter = '';
     if ($elmType == Object::TYPE_DATE) {
         $filter = '|formatDate@DATE_LONG';
     }
     if ($elmType == Object::TYPE_DATETIME) {
         $filter = '|formatDate@DATETIME_LONG';
     }
     if ($elmType == Object::TYPE_FLOAT || $elmType == Object::TYPE_DECIMAL) {
         $dec_num = isset($this->mapping[$elmName]['dec_num']) ? $this->mapping[$elmName]['dec_num'] : 2;
         $filter = '|formatNumber@' . $dec_num;
     }
     return array('Macro' => '%' . $elmName . $filter . '%', 'Sortable' => true);
 }
开发者ID:arhe,项目名称:pwak,代码行数:45,代码来源:GenericGrid.php

示例7: load

 /**
  * Loads fixtures from the directory
  *
  * @return void
  * @author Dan Cox
  */
 public function load()
 {
     $this->loader = new DirectoryLoader($this->directory);
     $this->fixtureList = $this->loader->load();
 }
开发者ID:antoligy,项目名称:Framework,代码行数:11,代码来源:FixtureManager.php

示例8: load

 /**
  * Loads a service file into the loader.
  *
  * @return void
  * @author Dan Cox
  */
 public static function load($serviceFile)
 {
     static::$loader->load($serviceFile . '.yml');
 }
开发者ID:danzabar,项目名称:alice,代码行数:10,代码来源:DI.php

示例9: add

 /**
  * Adds a command to the library
  *
  * @return Application
  */
 public function add($command)
 {
     $tasks = $this->prepper->load(get_class($command))->describe();
     $this->library->add(['task' => $tasks, 'class' => $command]);
     return $this;
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:11,代码来源:Application.php

示例10: searchAndReplace

 /**
  * Uses the matcher and Replacement classes to search for matches and systematically replace them.
  *
  * @return String
  * @author Dan Cox
  */
 public function searchAndReplace($str)
 {
     $this->matcher->load($str, $this->collection);
     return $this->matcher->searchAndReplace();
 }
开发者ID:danzabar,项目名称:masquerade,代码行数:11,代码来源:Masquerade.php

示例11: autoHandlePostDataWithLinks

 /**
  * Fonction qui remplit un objet récursivement à partir de données POST.
  * Ex:
  * pour un objet A qui a les propriétés suivantes:
  *     - name
  *     - child (un objet lié)
  *     - XXXCollection de type *..*
  * on devrait avoir comme données POST:
  * - POST['A_name'] = 'toto'
  * - POST['A_child_ID'] = 0 (l'objet lié n'existe pas il faut le créer)
  * - POST['child_name'] = 'titi' soit les propriétés de l'objet lié...
  * - POST['A_XXXCollection'] = array (le chps du form: name='A_XXXCollection[]')
  *
  * Cette fonction est donc valable pour les formulaires "dénormalisés",
  * c'est à dire les formulaires dans lesquels on mélange les propriétés
  * d'un objet et de ses objets liés. pour un exemple, regarder
  * SiteAddEdit.php et le template correspondant
  * lib/templates/Site/SiteAddEdit.html
  * ### A appeler dans une transaction !
  *
  * @static
  * @param array $postdata les données POST
  * @param object $baseObject l'objet de base
  * @param string $clsname nom de l'objet (si false, on se base sur
  * $baseObject pour le trouver)
  * @param string $prefix prefixe ajouté au clé du tableau $postdata
  * @return void
  **/
 static function autoHandlePostDataWithLinks($postdata, $baseObject, $clsname = false, $prefix = '')
 {
     if (!is_array($postdata)) {
         trigger_error('autoHandlePostDataWithLinks() need POST data.', E_USER_ERROR);
     }
     if (!is_object($baseObject)) {
         trigger_error('autoHandlePostDataWithLinks() need a base object', E_USER_ERROR);
     }
     $clsname = false == $clsname ? get_class($baseObject) : $clsname;
     /**
      * On remplit l'objet
      **/
     foreach ($baseObject->getProperties() as $property => $class) {
         $setter = sprintf("set%s", $property);
         if (!method_exists($baseObject, $setter)) {
             continue;
         }
         $property = $prefix . $clsname . '_' . $property;
         if (!is_string($class) && isset($postdata[$property])) {
             // propriétés simples
             $baseObject->{$setter}($postdata[$property]);
         } else {
             if (isset($postdata[$property . '_ID'])) {
                 $id = $postdata[$property . '_ID'];
                 if (isset($id) && intval($id) > 0) {
                     $childObject = Object::load($class, $id);
                     $baseObject->{$setter}($childObject);
                 } else {
                     $baseObject->{$setter}($id);
                 }
             }
         }
     }
     // Gestion des Collection attributes *..*
     foreach ($baseObject->getLinks() as $property => $detail) {
         $setter = sprintf("set%sCollectionIds", $property);
         if (!method_exists($baseObject, $setter)) {
             continue;
         }
         $property = $prefix . $clsname . '_' . $property . 'Collection';
         if (isset($_REQUEST[$property]) && false != $_REQUEST[$property]) {
             if (!is_array($_REQUEST[$property])) {
                 $_REQUEST[$property] = array($_REQUEST[$property]);
             }
             $baseObject->{$setter}($_REQUEST[$property]);
         }
     }
 }
开发者ID:arhe,项目名称:pwak,代码行数:76,代码来源:Form.php

示例12: load

 /**
  * Loads a file by name
  *
  * @param String $filename
  * @return DI
  * @author Dan Cox
  */
 public function load($filename)
 {
     static::$loader->load($filename . '.yml');
     return $this;
 }
开发者ID:antoligy,项目名称:Framework,代码行数:12,代码来源:DI.php

示例13: synchronize

 /**
  * Given a UF user object, make sure there is a contact
  * object for this user. If the user has new values, we need
  * to update the CRM DB with the new values
  *
  * @param Object  $user    the drupal user object
  * @param boolean $update  has the user object been edited
  * @param         $uf
  * 
  * @return void
  * @access public
  * @static
  */
 function synchronize(&$user, $update, $uf)
 {
     $session =& CRM_Core_Session::singleton();
     if (!is_object($session)) {
         return;
     }
     if ($uf == 'Drupal') {
         $key = 'uid';
         $mail = 'mail';
     } else {
         if ($uf == 'Mambo') {
             $key = 'id';
             $mail = 'email';
         } else {
             CRM_Utils_System::statusBounce(ts('Please set the user framework variable'));
         }
     }
     // have we already processed this user, if so early
     // return.
     $userID = $session->get('userID');
     $ufID = $session->get('ufID');
     if (!$update && $ufID == $user->{$key}) {
         return;
     }
     // reset the session if we are a different user
     if ($ufID && $ufID != $user->{$key}) {
         $session->reset();
     }
     // make sure we load the mambo object to get valid information
     if ($uf == 'Mambo') {
         $user->load();
     }
     // if the id of the object is zero (true for drupal), return early
     if ($user->{$key} == 0) {
         return;
     }
     $ufmatch =& CRM_Core_BAO_UFMatch::synchronizeUFMatch($user, $user->{$key}, $user->{$mail}, $uf);
     if (!$ufmatch) {
         return;
     }
     $session->set('ufID', $ufmatch->uf_id);
     $session->set('userID', $ufmatch->contact_id);
     $session->set('domainID', $ufmatch->domain_id);
     $session->set('ufEmail', $ufmatch->email);
     if ($update) {
         // the only information we care about is email, so lets check that
         if ($user->{$mail} != $ufmatch->email) {
             // email has changed, so we need to change all our primary email also
             $ufmatch->email = $user->{$mail};
             $ufmatch->save();
             $query = "\nUPDATE  civicrm_contact\nLEFT JOIN civicrm_location ON ( civicrm_location.entity_table = 'civicrm_contact' AND\n                                civicrm_contact.id  = civicrm_location.entity_id  AND\n                                civicrm_location.is_primary = 1 )\nLEFT JOIN civicrm_email    ON ( civicrm_location.id = civicrm_email.location_id   AND\n                                civicrm_email.is_primary = 1    )\nSET civicrm_email.email = '" . $user->{$mail} . "' WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($ufmatch->contact_id, 'Integer');
             CRM_Core_DAO::executeQuery($query);
         }
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:68,代码来源:UFMatch.php

示例14: test_throwexceptionOnUnknownHelper

 /**
  * Test that the helpers throw an exception when it cant find the helper
  *
  * @return void
  * @author Dan Cox
  */
 public function test_throwexceptionOnUnknownHelper()
 {
     $this->setExpectedException('Danzabar\\CLI\\Tasks\\Exceptions\\RegisteredHelperClassNotFoundException');
     $this->helpers->load('unknown');
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:11,代码来源:HelperTest.php

示例15: setUp

 /**
  * Set up tests
  *
  * @return void
  * @author Dan Cox
  */
 public function setUp()
 {
     parent::setUp();
     $this->config = new ConfigFile();
     $this->config->load(__DIR__ . '/Connections/database_test1.yml');
 }
开发者ID:danzabar,项目名称:alice,代码行数:12,代码来源:ConnectionTest.php


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