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


PHP TableRegistry::locator方法代码示例

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


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

示例1: testTableLocator

 /**
  * Tests tableLocator method
  *
  * @return void
  */
 public function testTableLocator()
 {
     $tableLocator = $this->subject->tableLocator();
     $this->assertSame(TableRegistry::locator(), $tableLocator);
     $newLocator = $this->getMock('Cake\\ORM\\Locator\\LocatorInterface');
     $subjectLocator = $this->subject->tableLocator($newLocator);
     $this->assertSame($newLocator, $subjectLocator);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:13,代码来源:LocatorAwareTraitTest.php

示例2: get

 /**
  * Get the factory for the specified repository type.
  *
  * @param string $type The repository type to get the factory for.
  * @throws InvalidArgumentException If the specified repository type has no factory.
  * @return callable The factory for the repository type.
  */
 public static function get($type)
 {
     if (!isset(static::$_modelFactories['Table'])) {
         static::$_modelFactories['Table'] = [TableRegistry::locator(), 'get'];
     }
     if (!isset(static::$_modelFactories[$type])) {
         throw new InvalidArgumentException(sprintf('Unknown repository type "%s". Make sure you register a type before trying to use it.', $type));
     }
     return static::$_modelFactories[$type];
 }
开发者ID:nrother,项目名称:cakephp,代码行数:17,代码来源:FactoryLocator.php

示例3: tableLocator

 /**
  * Sets the table locator.
  * If no parameters are passed, it will return the currently used locator.
  *
  * @param \Cake\ORM\Locator\LocatorInterface|null $tableLocator LocatorInterface instance.
  * @return \Cake\ORM\Locator\LocatorInterface
  */
 public function tableLocator(LocatorInterface $tableLocator = null)
 {
     if ($tableLocator !== null) {
         $this->_tableLocator = $tableLocator;
     }
     if (!$this->_tableLocator) {
         $this->_tableLocator = TableRegistry::locator();
     }
     return $this->_tableLocator;
 }
开发者ID:rlugojr,项目名称:cakephp,代码行数:17,代码来源:LocatorAwareTrait.php

示例4: __construct

 /**
  * Constructor. Looks at Session configuration information and
  * sets up the session model.
  *
  * @param array $config The configuration for this engine. It requires the 'model'
  * key to be present corresponding to the Table to use for managing the sessions.
  */
 public function __construct(array $config = [])
 {
     $tableLocator = isset($config['tableLocator']) ? $config['tableLocator'] : TableRegistry::locator();
     if (empty($config['model'])) {
         $config = $tableLocator->exists('Sessions') ? [] : ['table' => 'sessions'];
         $this->_table = $tableLocator->get('Sessions', $config);
     } else {
         $this->_table = $tableLocator->get($config['model']);
     }
     $this->_timeout = ini_get('session.gc_maxlifetime');
 }
开发者ID:thanghexp,项目名称:project,代码行数:18,代码来源:DatabaseSession.php

示例5: testLocatorDefault

 /**
  * Test that locator() method is returing TableLocator by default.
  *
  * @return void
  */
 public function testLocatorDefault()
 {
     $locator = TableRegistry::locator();
     $this->assertInstanceOf('Cake\\ORM\\Locator\\TableLocator', $locator);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:10,代码来源:TableRegistryTest.php


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