/**
  * Define the hydration schema based on a query object.
  * Fills the Formatter's properties using a Criteria as source
  *
  * @param \Propel\Runtime\ActiveQuery\BaseModelCriteria $criteria
  * @param \Propel\Runtime\DataFetcher\DataFetcherInterface|null $dataFetcher
  *
  * @return $this|\Propel\Runtime\Formatter\AbstractFormatter The current formatter object
  */
 public function init(BaseModelCriteria $criteria, DataFetcherInterface $dataFetcher = null)
 {
     $this->dbName = $criteria->getDbName();
     $this->setClass($criteria->getModelName());
     $this->setWith($criteria->getWith());
     $this->asColumns = array_merge($criteria->getSelectColumns(), $criteria->getAsColumns());
     $this->hasLimit = $criteria->getLimit() !== -1;
     if ($dataFetcher) {
         $this->setDataFetcher($dataFetcher);
     }
     return $this;
 }
 /**
  * Ensures deep cloning of attached objects
  */
 public function __clone()
 {
     parent::__clone();
     foreach ($this->with as $key => $join) {
         $this->with[$key] = clone $join;
     }
     if (null !== $this->formatter) {
         $this->formatter = clone $this->formatter;
     }
 }
Exemple #3
0
 /**
  * Override method to prevent an addition of self columns.
  *
  * @param string $name
  * @return $this|Criteria
  */
 public function addSelectColumn($name)
 {
     $this->isSelfSelected = true;
     return parent::addSelectColumn($name);
 }