Exemplo n.º 1
0
 public function __construct($adapter = '')
 {
     if (!$adapter) {
         // using $this->class as a fallback
         if (class_exists($class = $this->class)) {
             list($adapterClass, $type) = DbFinderAdapterUtils::getParams($class);
             $this->adapter = new $adapterClass($class);
             $this->type = $type;
         }
     } else {
         if ($adapter instanceof sfModelFinder) {
             $this->adapter = $adapter;
             $this->type = DbFinderAdapterUtils::getType($adapter);
         } else {
             throw new Exception('DbFinder constructor expects a sfModelFinder instance');
         }
     }
     $this->initialize();
 }