本文整理汇总了PHP中Mage_Core_Model_Config::getModelInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config::getModelInstance方法的具体用法?PHP Mage_Core_Model_Config::getModelInstance怎么用?PHP Mage_Core_Model_Config::getModelInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Config
的用法示例。
在下文中一共展示了Mage_Core_Model_Config::getModelInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getReader
/**
* Reader object initialization
*
* @return Magento_Acl_Config_Reader
*/
protected function _getReader()
{
if (null === $this->_reader) {
$aclResourceFiles = $this->_getAclResourceFiles();
$this->_reader = $this->_config->getModelInstance('Magento_Acl_Config_Reader', $aclResourceFiles);
}
return $this->_reader;
}
示例2: getArgumentHandlerFactoryByType
/**
* Get argument handler factory by given type
* @param string $type
* @return Mage_Core_Model_Layout_Argument_HandlerFactoryInterface
* @throws InvalidArgumentException
*/
public function getArgumentHandlerFactoryByType($type)
{
if (false == is_string($type)) {
throw new InvalidArgumentException('Passed invalid argument handler type');
}
if (!isset($this->_handlerFactories[$type])) {
throw new InvalidArgumentException('Argument handler ' . $type . ' is not exists');
}
/** @var $handlerFactory Mage_Core_Model_Layout_Argument_HandlerFactoryInterface */
$handlerFactory = $this->_objectFactory->getModelInstance($this->_handlerFactories[$type]);
return $handlerFactory;
}
示例3: applyUpdaters
/**
* Apply all updater to value
*
* @param mixed $value
* @param array $updaters
* @throws InvalidArgumentException
* @return mixed
*/
public function applyUpdaters($value, array $updaters = array())
{
foreach ($updaters as $updater) {
/** @var Mage_Core_Model_Layout_Argument_UpdaterInterface $updaterInstance */
$updaterInstance = $this->_objectFactory->getModelInstance($updater);
if (false === $updaterInstance instanceof Mage_Core_Model_Layout_Argument_UpdaterInterface) {
throw new InvalidArgumentException($updater . ' should implement Mage_Core_Model_Layout_Argument_UpdaterInterface');
}
$value = $updaterInstance->update($value);
}
return $value;
}
示例4: getAcl
/**
* Build Access Control List
*
* @return Magento_Acl
* @throws LogicException
*/
public function getAcl()
{
if (!$this->_acl) {
try {
$acl = $this->_objectFactory->getModelInstance('Magento_Acl');
$this->_objectFactory->getModelInstance($this->_getLoaderClass('resource'))->populateAcl($acl);
$this->_objectFactory->getModelInstance($this->_getLoaderClass('role'))->populateAcl($acl);
$this->_objectFactory->getModelInstance($this->_getLoaderClass('rule'))->populateAcl($acl);
$this->_acl = $acl;
} catch (Exception $e) {
throw new LogicException('Could not create acl object: ' . $e->getMessage());
}
}
return $this->_acl;
}
示例5: _addResourceTree
/**
* Add list of nodes and their children to acl
*
* @param Magento_Acl $acl
* @param DOMNodeList $resources
* @param Magento_Acl_Resource $parent
*/
protected function _addResourceTree(Magento_Acl $acl, DOMNodeList $resources, Magento_Acl_Resource $parent = null)
{
/** @var $resourceConfig DOMElement */
foreach ($resources as $resourceConfig) {
if (!$resourceConfig instanceof DOMElement) {
continue;
}
/** @var $resource Magento_Acl_Resource */
$resource = $this->_objectFactory->getModelInstance('Magento_Acl_Resource', $resourceConfig->getAttribute('id'));
$acl->addResource($resource, $parent);
if ($resourceConfig->hasChildNodes()) {
$this->_addResourceTree($acl, $resourceConfig->childNodes, $resource);
}
}
}
示例6: getConfiguration
/**
* Load system configuration
*
* @return Mage_Backend_Model_Config_Structure
*/
public function getConfiguration()
{
if ($this->_cache->canUse('config')) {
$cache = $this->_cache->load(self::CACHE_SYSTEM_CONFIGURATION_STRUCTURE);
if ($cache) {
return unserialize($cache);
}
}
$fileNames = $this->_appConfig->getModuleConfigurationFiles('adminhtml' . DIRECTORY_SEPARATOR . 'system.xml');
$config = $this->_appConfig->getModelInstance('Mage_Backend_Model_Config_Structure', array('sourceFiles' => $fileNames));
if ($this->_cache->canUse('config')) {
$this->_cache->save(serialize($config), self::CACHE_SYSTEM_CONFIGURATION_STRUCTURE, array(Mage_Core_Model_Config::CACHE_TAG));
}
return $config;
}
示例7: _getArgumentUpdater
/**
* Get argument updater instance
*
* @return Mage_Core_Model_Layout_Argument_Updater
*/
protected function _getArgumentUpdater()
{
if (null === $this->_argumentUpdater) {
$this->_argumentUpdater = $this->_objectFactory->getModelInstance('Mage_Core_Model_Layout_Argument_Updater', array('objectFactory' => $this->_objectFactory));
}
return $this->_argumentUpdater;
}
示例8: getCaptcha
/**
* Get Captcha
*
* @param string $formId
* @return Mage_Captcha_Model_Interface
*/
public function getCaptcha($formId)
{
if (!array_key_exists($formId, $this->_captcha)) {
$type = ucfirst($this->getConfigNode('type'));
if (!$type) {
$type = self::DEFAULT_CAPTCHA_TYPE;
}
$this->_captcha[$formId] = $this->_config->getModelInstance('Mage_Captcha_Model_' . $type, array('params' => array('formId' => $formId, 'helper' => $this)));
}
return $this->_captcha[$formId];
}
示例9: _getDom
/**
* @return DOMDocument
*/
protected function _getDom()
{
$mergedConfigXml = $this->_loadCache();
if ($mergedConfigXml) {
$mergedConfig = new DOMDocument();
$mergedConfig->loadXML($mergedConfigXml);
} else {
$fileList = $this->getMenuConfigurationFiles();
$mergedConfig = $this->_appConfig->getModelInstance('Mage_Backend_Model_Menu_Config_Menu', $fileList)->getMergedConfig();
$this->_saveCache($mergedConfig->saveXML());
}
return $mergedConfig;
}
示例10: _getPathConfig
/**
* Return formatted config data for specified path prefix
*
* @param string $path Config path prefix
* @param bool $full Simple config structure or not
* @return array
*/
protected function _getPathConfig($path, $full = true)
{
$configDataCollection = $this->_objectFactory->getModelInstance('Mage_Core_Model_Config_Data')->getCollection()->addScopeFilter($this->getScope(), $this->getScopeId(), $path);
$config = array();
foreach ($configDataCollection as $data) {
if ($full) {
$config[$data->getPath()] = array('path' => $data->getPath(), 'value' => $data->getValue(), 'config_id' => $data->getConfigId());
} else {
$config[$data->getPath()] = $data->getValue();
}
}
return $config;
}
示例11: createFromArray
/**
* Create menu item from array
*
* @param array $data
* @return Mage_Backend_Model_Menu_Item
*/
public function createFromArray(array $data = array())
{
$module = 'Mage_Backend_Helper_Data';
if (isset($data['module'])) {
$module = $data['module'];
}
$data['module'] = isset($this->_helpers[$module]) ? $this->_helpers[$module] : Mage::helper($module);
$data['acl'] = $this->_acl;
$data['appConfig'] = $this->_appConfig;
$data['storeConfig'] = $this->_storeConfig;
$data['menuFactory'] = $this->_menuFactory;
$data['urlModel'] = $this->_urlModel;
$data['validator'] = $this->_validator;
return $this->_objectFactory->getModelInstance('Mage_Backend_Model_Menu_Item', $data);
}
示例12: getModelInstance
public function getModelInstance($modelClass = '', $constructArguments = array())
{
if ($classObj = $this->modelMocks[$modelClass]) {
return clone $classObj;
}
$modelName = $this->getModelClassName($modelClass);
if (!$this->getDisableDoubles()) {
$mockClassName = str_replace('_Model_', '_Test_Double_Model_', $modelName);
if (class_exists($mockClassName)) {
$obj = new $mockClassName($constructArguments);
return $obj;
}
}
if ($modelName == 'Mage_Core_Model_Resource') {
$obj = new Codex_Xtest_Model_Core_Resource($constructArguments);
return $obj;
}
return parent::getModelInstance($modelClass, $constructArguments);
}
示例13: _getMenuIterator
/**
* Get menu filter iterator
*
* @param Mage_Backend_Model_Menu $menu menu model
* @return Mage_Backend_Model_Menu_Filter_Iterator
*/
protected function _getMenuIterator(Mage_Backend_Model_Menu $menu)
{
return $this->_objectFactory->getModelInstance('Mage_Backend_Model_Menu_Filter_Iterator', $menu->getIterator());
}
示例14: getModelInstance
/**
* Overriden for test case model instance creation mocking
*
* (non-PHPdoc)
* @see Mage_Core_Model_Config::getModelInstance()
*/
public function getModelInstance($modelClass = '', $constructArguments = array())
{
if (!isset($this->_replaceInstanceCreation['model'][$modelClass])) {
return parent::getModelInstance($modelClass, $constructArguments);
}
return $this->_replaceInstanceCreation['model'][$modelClass];
}
示例15: create
public function create()
{
return $this->_objectFactory->getModelInstance('Mage_Core_Model_Resource_Transaction');
}