本文整理汇总了PHP中ComponentCollection::load方法的典型用法代码示例。如果您正苦于以下问题:PHP ComponentCollection::load方法的具体用法?PHP ComponentCollection::load怎么用?PHP ComponentCollection::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComponentCollection
的用法示例。
在下文中一共展示了ComponentCollection::load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Magic method for lazy loading $components.
*
* @param string $name Name of component to get.
* @return mixed A Component object or null.
*/
public function __get($name) {
if (isset($this->_componentMap[$name]) && !isset($this->{$name})) {
$settings = array_merge((array)$this->_componentMap[$name]['settings'], array('enabled' => false));
$this->{$name} = $this->_Collection->load($this->_componentMap[$name]['class'], $settings);
}
if (isset($this->{$name})) {
return $this->{$name};
}
}
示例2: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
Configure::write('Acl.classname', 'HabtmDbAcl');
Configure::write('Acl.database', 'test');
$Collection = new ComponentCollection();
$this->Acl = $Collection->load('Acl', array('habtm' => array('userModel' => 'Employee', 'groupAlias' => 'Department')));
$this->_setPermissions();
}
示例3: paginate
/**
* Handles automatic pagination of model records.
*
* @param Model|string $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel')
* @param string|array $scope Conditions to use while paginating
* @param array $whitelist List of allowed options for paging
* @return array Model query results
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate
*/
public function paginate($object = null, $scope = array(), $whitelist = array())
{
return $this->Components->load('Paginator', $this->paginate)->paginate($object, $scope, $whitelist);
}
示例4: testMultipleComponentInitialize
/**
* test a component being used more than once.
*
* @return void
*/
public function testMultipleComponentInitialize()
{
$Collection = new ComponentCollection();
$Banana = $Collection->load('Banana');
$Orange = $Collection->load('Orange');
$this->assertSame($Banana, $Orange->Banana, 'Should be references');
$Banana->testField = 'OrangeField';
$this->assertSame($Banana->testField, $Orange->Banana->testField, 'References are broken');
}
示例5: testGet
/**
* Test lazy loading of components inside components and both explicit and
* implicit 'enabled' setting.
*
* @return void
*/
public function testGet()
{
$Collection = new ComponentCollection();
$ParamTest = $Collection->load('ParamTest');
$this->assertTrue($ParamTest->Apple->settings['enabled']);
$this->assertFalse($ParamTest->Banana->settings['enabled']);
}
示例6: paginate
/**
* Handles automatic pagination of model records.
*
* @param Model|string $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel')
* @param string|array $scope Conditions to use while paginating
* @param array $whitelist List of allowed options for paging
* @return array Model query results
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate
* @deprecated Will be removed in 3.0. Use PaginatorComponent instead.
*/
public function paginate($object = null, $scope = array(), $whitelist = array()) {
if($this->Session->read('exportar') == ("Pdf" || "Xls")){
$this->Paginator->settings['limit'] = 0;
}
return $this->Components->load('Paginator', $this->paginate)->paginate($object, $scope, $whitelist);
}