示例#1
0
 /**
  * Sets the model query to this parser and initializes the parser for this model query.
  * @param zibo\library\orm\query\ModelQuery $modelQuery
  * @return null
  */
 private function setModelQuery(ModelQuery $modelQuery)
 {
     $this->meta = $modelQuery->getModel()->getMeta();
     $this->recursiveDepth = $modelQuery->getRecursiveDepth();
     $this->localize = false;
     $this->locale = $modelQuery->getLocale();
     $this->includeUnlocalizedData = $modelQuery->willIncludeUnlocalizedData();
     $this->addIsLocalizedOrder = $modelQuery->willAddIsLocalizedOrder();
     $this->fields = array();
     $this->recursiveBelongsToFields = array();
     $this->recursiveHasFields = array();
     $this->tables = array();
     $this->fieldJoins = array();
     $this->conditionJoins = array();
     $this->addTable($this->meta->getName(), self::ALIAS_SELF);
     $this->addTable($this->meta->getName() . LocalizedModel::MODEL_SUFFIX, self::ALIAS_SELF_LOCALIZED);
     $this->statement = new SelectStatement();
     $this->statement->addTable($this->tables[self::ALIAS_SELF]);
     $joins = $modelQuery->getJoins();
     foreach ($joins as $join) {
         $table = $join->getTable();
         $this->addTable($table->getModelName(), $table->getAlias());
     }
 }