當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Doctrine_Lib::arrayDeepMerge方法代碼示例

本文整理匯總了PHP中Doctrine_Lib::arrayDeepMerge方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Lib::arrayDeepMerge方法的具體用法?PHP Doctrine_Lib::arrayDeepMerge怎麽用?PHP Doctrine_Lib::arrayDeepMerge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine_Lib的用法示例。


在下文中一共展示了Doctrine_Lib::arrayDeepMerge方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * __construct
  *
  * @param string $options 
  * @return void
  */
 public function __construct(array $options = array())
 {
     $dispatcher = ProjectConfiguration::getActive()->getEventDispatcher();
     $dispatcher->connect('commentable.add_commentable_class', array($this, 'getCommentables'));
     $options['generatePath'] = sfConfig::get('sf_lib_dir') . '/model/doctrine/sfCommentsPlugin';
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
 }
開發者ID:bshaffer,項目名稱:Symplist,代碼行數:13,代碼來源:CommentLinkGenerator.class.php

示例2: setUp

 /**
  * Initialize the template
  * @return void
  */
 public function setUp()
 {
     // TODO: cache compiled options since they do not change frequently
     $options = $this->options;
     // merge in special soft delete options
     if ($this->getInvoker()->getTable()->hasTemplate('SoftDelete')) {
         $options = Doctrine_Lib::arrayDeepMerge($options, $this->optionsWhenSoftDeleteIsEnabled);
     }
     // merge in options defined in the schema
     $options = Doctrine_Lib::arrayDeepMerge($options, $this->_options);
     // merge in default options for credentials
     foreach ($options['credentials'] as $credential => $cOptions) {
         $options['credentials'][$credential] = array_merge($this->credentialOptions, $cOptions);
     }
     // merge in default options for fields
     foreach ($options['fields'] as $fieldName => $fieldOptions) {
         $fieldOptions = array_merge($this->fieldOptions, $fieldOptions);
         if (!is_string($fieldOptions['view']) && !is_null($fieldOptions['view']) && $fieldOptions['view'] !== false) {
             throw new InvalidArgumentException(sprintf('view credential has an invalid type for field %s.', $fieldName));
         }
         if (!is_string($fieldOptions['edit']) && !is_null($fieldOptions['edit']) && $fieldOptions['edit'] !== false) {
             throw new InvalidArgumentException(sprintf('edit credential has an invalid type for field %s.', $fieldName));
         }
         if (!is_string($fieldOptions['create']) && !is_null($fieldOptions['create']) && $fieldOptions['create'] !== false) {
             throw new InvalidArgumentException(sprintf('create credential has an invalid type for field %s.', $fieldName));
         }
         $options['fields'][$fieldName] = $fieldOptions;
     }
     $options['credentials'] = $this->copyRelationsToEachSide($options['credentials']);
     $this->options = $options;
 }
開發者ID:schmittjoh,項目名稱:jmsDoctrinePlugin,代碼行數:35,代碼來源:Credentialable.class.php

示例3: __construct

 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!isset($this->_options['connection'])) {
         $this->_options['connection'] = Doctrine_Manager::connection();
     }
 }
開發者ID:pierswarmers,項目名稱:rtCorePlugin,代碼行數:7,代碼來源:rtCommentTemplate.class.php

示例4: __construct

 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!$this->_options['onlyOwnable']) {
         $this->_plugin = new Doctrine_Guardable($this->_options);
     }
 }
開發者ID:everzet,項目名稱:sfDoctrineObjectGuardPlugin,代碼行數:7,代碼來源:Guardable.php

示例5: __construct

 /**
  * Constructor for Locatable Template
  *
  * @param array $options
  *
  * @return void
  */
 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!$this->_options['fields']) {
         throw new sfException('The Geolocatable Behavior requires the "fields" option to be set in your schema');
     }
 }
開發者ID:jwegner,項目名稱:csDoctrineActAsGeolocatablePlugin,代碼行數:14,代碼來源:Geolocatable.php

示例6: fill

 public function fill($name, $values = array())
 {
     $formValues = Doctrine_Lib::arrayDeepMerge($this->getFormValues($name), $values);
     foreach ($formValues as $key => $value) {
         $this->setDefaultField($key, $value);
     }
     return $this->getObjectToReturn();
 }
開發者ID:bshaffer,項目名稱:Symfony-Snippets,代碼行數:8,代碼來源:csTesterForm.class.php

示例7: setOption

 /** 
  * setOption 
  * sets an option in order to allow flexible listener chaining 
  * 
  * @param mixed $name              the name of the option to set 
  * @param mixed $value              the value of the option 
  */
 public function setOption($name, $value = null)
 {
     if (is_array($name)) {
         $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $name);
     } else {
         $this->_options[$name] = $value;
     }
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:15,代碼來源:Chain.php

示例8: __construct

 /**
  * __construct
  *
  * @param string $array
  * @return null
  */
 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->getOptions(), $options);
     $this->invokerNamespace = sprintf('%s/%s', __CLASS__, sfCacheTaggingToolkit::generateVersion());
     $versionColumn = $this->getOption('versionColumn');
     if (!is_string($versionColumn) || 0 >= strlen($versionColumn)) {
         throw new sfConfigurationException(sprintf('sfCacheTaggingPlugin: "%s" behaviors "versionColumn" ' . 'should be string and not empty, passed "%s"', sfCacheTaggingToolkit::TEMPLATE_NAME, (string) $versionColumn));
     }
 }
開發者ID:uniteddiversity,項目名稱:policat,代碼行數:15,代碼來源:Cachetaggable.php

示例9: __construct

 /**
  * __construct 
  * 
  * @param array $options 
  * @return void
  */
 public function __construct(array $options)
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!isset($this->_options['analyzer'])) {
         $this->_options['analyzer'] = new Doctrine_Search_Analyzer_Standard();
     }
     if (!isset($this->_options['connection'])) {
         $this->_options['connection'] = Doctrine_Manager::connection();
     }
 }
開發者ID:walterfrs,項目名稱:mladek,代碼行數:16,代碼來源:Search.php

示例10: __construct

 /**
  * __construct 
  * 
  * @param array $options 
  * @return void
  */
 public function __construct(array $options)
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!isset($this->_options['analyzer'])) {
         $this->_options['analyzer'] = 'Doctrine_Search_Analyzer_Standard';
     }
     if (!isset($this->_options['analyzer_options'])) {
         $this->_options['analyzer_options'] = array();
     }
     $this->_options['analyzer'] = new $this->_options['analyzer']($this->_options['analyzer_options']);
 }
開發者ID:dennybrandes,項目名稱:doctrine1,代碼行數:17,代碼來源:Search.php

示例11: __construct

 /**
  * @param array $options
  *
  * options can contain:
  *
  *  - string   thumb_dir    The directory to create the thumbnails in (relative to the file's dirname)
  *  - boolean  on_demand    Whether to create or not thumbnails on demand
  *  - boolean  on_save      Whether to create or not thumbnails on save
  *  - boolean  strict       Whether to allow other formats than those in 'formats'
  *  - array    formats      Default formats to create for on_save
  *
  *  the 'formats' array should contain a list of formats per-field:
  *
  *  array(
  *    'media_id'    => array('50x50')
  *    'cover_image' => array('100x50')
  *  )
  */
 public function __construct(array $options = array())
 {
     if (!class_exists('sfThumbnail')) {
         throw new sfException('You need the sfThumbnailPlugin installed to use this template');
     }
     $app_config = array();
     if (isset($options['config_key'])) {
         if (null === ($app_config = sfConfig::get('app_' . $options['config_key'], null))) {
             throw new sfException(sprintf('Could not find configuration in key "%s", maybe you forget a ".plugins" in your app.yml ?', $options['config_key']));
         }
     }
     $this->options = Doctrine_Lib::arrayDeepMerge($this->options, $options, $app_config);
 }
開發者ID:ubermuda,項目名稱:sfDoctrineThumbnailablePlugin,代碼行數:31,代碼來源:DoctrineThumbnailable.class.php

示例12: __construct

 /**
  * Constructor for Markdown Template
  *
  * @param array $options 
  * @return void
  * @author Brent Shaffer
  */
 public function __construct(array $options = array())
 {
     if (!isset($options['fields'])) {
         throw new sfException("Required parameter 'fields' not set in Doctrine Markdown");
     }
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     // Set markdown field names if they are not set by the user
     foreach ($this->_options['fields'] as $key => $value) {
         if (is_int($key)) {
             unset($this->_options['fields'][$key]);
             $this->_options['fields'][$value . '_html'] = $value;
         }
     }
 }
開發者ID:bshaffer,項目名稱:Symplist,代碼行數:21,代碼來源:MarkdownTemplate.class.php

示例13: setRoutingValue

  public function setRoutingValue(array $values)
  {
    $this->info('setting routing.yml config values');
      
    $path = sfConfig::get('sf_app_dir') . '/config/routing.yml';
        
    $config = Doctrine_Lib::arrayDeepMerge(sfYaml::load($path), $values);

    file_put_contents($path, sfYaml::dump($config));
    
    sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
    
    return $this;
  }
開發者ID:romankallweit,項目名稱:swingmachine,代碼行數:14,代碼來源:sfTestFunctionalHadori.class.php

示例14: joinForTableProxy

 public function joinForTableProxy(Doctrine_Query $q, array $options = array())
 {
     $options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     $q->getRootAlias();
     // fix for initialize root
     if (empty($options['parentTable'])) {
         $parentTable = $q->getRoot();
         $parentTableAlias = $q->getRootAlias();
     } else {
         $parentTable = Doctrine::getTable($options['parentTable']);
         $parentTableAlias = empty($options['parentTableAlias']) ? $q->getSqlTableAlias(sfInflector::tableize($options['parentTable'])) : $options['parentTableAlias'];
     }
     if (!empty($options['componentAlias'])) {
         $componentAlias = $options['componentAlias'];
     } elseif ($parentTable->hasRelation($this->_table->getComponentName())) {
         $componentAlias = $this->_table->getComponentName();
     } else {
         $componentName = $this->_table->getComponentName();
         $relations = $parentTable->getRelations();
         foreach ($relations as $relation) {
             if ($relation['class'] == $componentName) {
                 $componentAlias = $relation['alias'];
                 break;
             }
         }
     }
     $tableAlias = empty($options['tableAlias']) ? $this->_table->getAlias() : $options['tableAlias'];
     $q->addSqlTableAlias($tableAlias, sfInflector::tableize($this->_table->getComponentName()));
     $q->leftJoin($parentTableAlias . '.' . $componentAlias . ' ' . $tableAlias);
     if ($options['withI18n'] == true && $this->_table->hasTemplate('Doctrine_Template_I18nMod')) {
         $cultures = empty($options['cultures']) ? sfContext::getInstance()->getUser()->getCulture() : $options['cultures'];
         $chunkWith = implode(' AND ', array_fill(0, count($cultures), ' ' . $tableAlias . '_trans.lang = ? '));
         $q->leftJoin($tableAlias . '.Translation ' . $tableAlias . '_trans WITH ' . $chunkWith, $cultures);
     }
     return $q;
 }
開發者ID:relo-san,項目名稱:dinDoctrineExtraPlugin,代碼行數:36,代碼來源:Doctrine_Template_Joinable.php

示例15: _processInheritance

 /**
  * _processInheritance
  * 
  * Perform some processing on inheritance.
  * Sets the default type and sets some default values for certain types
  *
  * @param string $array 
  * @return void
  */
 protected function _processInheritance($array)
 {
     // Apply default inheritance configuration
     foreach ($array as $className => $definition) {
         if (!empty($array[$className]['inheritance'])) {
             $this->_validateSchemaElement('inheritance', array_keys($definition['inheritance']), $className . '->inheritance');
             // Default inheritance to concrete inheritance
             if (!isset($array[$className]['inheritance']['type'])) {
                 $array[$className]['inheritance']['type'] = 'concrete';
             }
             // Some magic for setting up the keyField and keyValue column aggregation options
             // Adds keyField to the parent class automatically
             if ($array[$className]['inheritance']['type'] == 'column_aggregation') {
                 // Set the keyField to 'type' by default
                 if (!isset($array[$className]['inheritance']['keyField'])) {
                     $array[$className]['inheritance']['keyField'] = 'type';
                 }
                 // Set the keyValue to the name of the child class if it does not exist
                 if (!isset($array[$className]['inheritance']['keyValue'])) {
                     $array[$className]['inheritance']['keyValue'] = $className;
                 }
                 $parent = $this->_findBaseSuperClass($array, $definition['className']);
                 // Add the keyType column to the parent if a definition does not already exist
                 if (!isset($array[$parent]['columns'][$array[$className]['inheritance']['keyField']])) {
                     $array[$parent]['columns'][$array[$className]['inheritance']['keyField']] = array('name' => $array[$className]['inheritance']['keyField'], 'type' => 'string', 'length' => 255);
                 }
             }
         }
     }
     // Array of the array keys to move to the parent, and the value to default the child definition to
     // after moving it. Will also populate the subclasses array for the inheritance parent
     $moves = array('columns' => array(), 'indexes' => array(), 'attributes' => array(), 'options' => array(), 'checks' => array());
     foreach ($array as $className => $definition) {
         // Move any definitions on the schema to the parent
         if (isset($definition['inheritance']['extends']) && isset($definition['inheritance']['type']) && ($definition['inheritance']['type'] == 'simple' || $definition['inheritance']['type'] == 'column_aggregation')) {
             $parent = $this->_findBaseSuperClass($array, $definition['className']);
             foreach ($moves as $move => $resetValue) {
                 if (isset($array[$parent][$move]) && isset($definition[$move])) {
                     $array[$parent][$move] = Doctrine_Lib::arrayDeepMerge($array[$parent][$move], $definition[$move]);
                     $array[$definition['className']][$move] = $resetValue;
                 }
             }
             // Populate the parents subclasses
             if ($definition['inheritance']['type'] == 'column_aggregation') {
                 // Fix for 2015: loop through superclasses' inheritance to the base-superclass to
                 // make sure we collect all keyFields needed (and not only the first)
                 $inheritanceFields = array($definition['inheritance']['keyField'] => $definition['inheritance']['keyValue']);
                 $superClass = $definition['inheritance']['extends'];
                 $multiInheritanceDef = $array[$superClass];
                 while (count($multiInheritanceDef['inheritance']) > 0 && array_key_exists('extends', $multiInheritanceDef['inheritance']) && $multiInheritanceDef['inheritance']['type'] == 'column_aggregation') {
                     $superClass = $multiInheritanceDef['inheritance']['extends'];
                     // keep original keyField with it's keyValue
                     if (!isset($inheritanceFields[$multiInheritanceDef['inheritance']['keyField']])) {
                         $inheritanceFields[$multiInheritanceDef['inheritance']['keyField']] = $multiInheritanceDef['inheritance']['keyValue'];
                     }
                     $multiInheritanceDef = $array[$superClass];
                 }
                 $array[$parent]['inheritance']['subclasses'][$definition['className']] = $inheritanceFields;
             }
         }
     }
     return $array;
 }
開發者ID:sensorsix,項目名稱:app,代碼行數:72,代碼來源:Schema.php


注:本文中的Doctrine_Lib::arrayDeepMerge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。