Exemple #1
0
 /**
  * Constructor
  *
  * @param ModelCriteria|string $modelOrQuery A query object, or model class as string.
  * @param array $options
  */
 public function __construct($modelOrQuery, array $options = array())
 {
     if (is_string($modelOrQuery)) {
         $this->model = $modelOrQuery;
         $this->query = PropelQuery::from($this->model);
     } else {
         if ($modelOrQuery instanceof ModelCriteria) {
             $this->query = $modelOrQuery;
             $this->model = $this->query->getModelName();
         } else {
             throw new Exception('Invalid argument');
         }
     }
     parent::__construct($options);
 }
Exemple #2
0
 /**
  * Constructor
  *
  * @param string $root
  * @param array $options
  */
 public function __construct($root, array $options = array())
 {
     $this->setRoot($root);
     parent::__construct($options);
 }