Development

Changeset 12809

You must first sign up to be able to contribute.

Changeset 12809

Show
Ignore:
Timestamp:
11/09/08 10:14:58 (8 months ago)
Author:
fabien
Message:

[1.2] fixed CLI tasks when some plugins register behaviors (closes #4645)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelPlugin/trunk/lib/addon/sfPropelBehavior.class.php

    r11123 r12809  
    1919class sfPropelBehavior 
    2020{ 
    21   static protected $behaviors = array(); 
     21  static protected 
     22    $loaded    = array(), 
     23    $behaviors = array(); 
    2224 
    2325  static public function registerMethods($name, $callables) 
     
    7880        foreach ($callables as $callable) 
    7981        { 
    80           sfMixer::register('Base'.$class.$hook, $callable); 
     82          $key = 'Base'.$class.$hook.'//'.self::callableToString($callable); 
     83          if (!isset(self::$loaded[$key])) 
     84          { 
     85            sfMixer::register('Base'.$class.$hook, $callable); 
     86            self::$loaded[$key] = true; 
     87          } 
    8188        } 
    8289      } 
     
    8592      foreach (self::$behaviors[$name]['methods'] as $callable) 
    8693      { 
    87         sfMixer::register('Base'.$class, $callable); 
     94        $key = 'Base'.$class.'//'.self::callableToString($callable); 
     95        if (!isset(self::$loaded[$key])) 
     96        { 
     97          sfMixer::register('Base'.$class, $callable); 
     98          self::$loaded[$key] = true; 
     99        } 
    88100      } 
    89101    } 
    90102  } 
     103 
     104  static protected function callableToString($callable) 
     105  { 
     106    return is_array($callable) ? (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'::'.$callable[1] : var_export($callable, true); 
     107  } 
    91108} 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.