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


PHP ComponentCollection::normalizeObjectArray方法代码示例

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


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

示例1: __construct

/**
 * Constructor
 *
 * @param ComponentCollection $collection A ComponentCollection this component can use to lazy load its components
 * @param array $settings Array of configuration settings.
 */
	public function __construct(ComponentCollection $collection, $settings = array()) {
		$this->_Collection = $collection;
		$this->settings = $settings;
		$this->_set($settings);
		if (!empty($this->components)) {
			$this->_componentMap = ComponentCollection::normalizeObjectArray($this->components);
		}
	}
开发者ID:sherix88,项目名称:sigedu,代码行数:14,代码来源:Component.php

示例2: init

/**
 * Initializes all the Components for a controller.
 * Attaches a reference of each component to the Controller.
 *
 * @param Controller $Controller Controller to initialize components for.
 * @return void
 */
	public function init(Controller $Controller) {
		if (empty($Controller->components)) {
			return;
		}
		$this->_Controller = $Controller;
		$components = ComponentCollection::normalizeObjectArray($Controller->components);
		foreach ($components as $name => $properties) {
			$Controller->{$name} = $this->load($properties['class'], $properties['settings']);
		}
	}
开发者ID:hungnt88,项目名称:5stars-1,代码行数:17,代码来源:ComponentCollection.php

示例3: loadComponent

 /**
  * Loads a Component
  *
  * @param string $componentClass Name of model class to load
  * @param array $settings array of settings
  * @return void
  * @access public
  **/
 public function loadComponent($componentClass, $settings = array())
 {
     if (empty($this->_internals['controller'])) {
         $this->loadController();
     }
     $components = ComponentCollection::normalizeObjectArray(array($componentClass => $settings));
     foreach ($components as $name => $properties) {
         $this->_internals['controller']->{$name} = $this->_internals['controller']->Components->load($properties['class'], $properties['settings']);
         $this->{$name} = $this->_internals['controller']->{$name};
     }
     if (method_exists($this->_internals['controller']->{$name}, 'initialize')) {
         $this->_internals['controller']->{$name}->initialize($this->_internals['controller']);
     }
     if (method_exists($this->_internals['controller']->{$name}, 'startup')) {
         $this->_internals['controller']->{$name}->startup($this->_internals['controller']);
     }
 }
开发者ID:josegonzalez,项目名称:cakephp-cake-djjob,代码行数:25,代码来源:CakeJob.php


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