コード例 #1
0
 /**
  * Merges passed config with defaults and stores in settings for the model
  * we're working on.
  *
  * @param AppModel $model The model object that the behavior is attached to
  * @param mixed $config Any settings declared when the behavior is attached to
  *    the model in the $actsAs property
  * @access public
  */
 function setup(&$model, $config = null)
 {
     // Process config
     if (!is_array($config)) {
         $config = array();
     }
     $config = array_merge($this->_ccDefaults, $config);
     // Let parent do the setup of settings property
     parent::setup($model, $config);
 }
コード例 #2
0
 /**
  * Initiate InfiniTree behavior
  *
  * @param object $Model instance of model
  * @param array $config array of configuration settings.
  * @return void
  * @access public
  */
 public function setup($Model, $config = array())
 {
     $defaults = array('scopeField' => false, 'counterCache' => false, 'directCounterCache' => false);
     $config = array_merge(array('scopeField' => false, 'counterCache' => false, 'directCounterCache' => false), $config);
     //Set default counterCache fieldnames if none specified
     if ($config['counterCache'] === true) {
         $config['counterCache'] = 'children_count';
     }
     if ($config['directCounterCache'] === true) {
         $config['directCounterCache'] = 'direct_children_count';
     }
     return parent::setup($Model, $config);
 }