/** * Get join info query for current condition; * @param bool $forCount * @return string */ public function getJoin($forCount = false) { if (!$this->with) { return $this->join; } if (!$this->relationsParser) { $this->relationsParser = RelationsParser::parse($this->model, $this, $this->conditionColumns); } return ($forCount ? $this->relationsParser->getForCount() : $this->relationsParser->getForMainSelect()) . ' ' . $this->join; }
/** * Reads all relations for current model. * @param $name * @return DbModel[]|DbModel */ private function getRelationFromDb($name) { if (!$this->relationsParser) { $this->relationsParser = RelationsParser::parse(get_class($this), new ModelCondition(['model' => get_class($this)]), '*'); } return $this->relationsParser->getForSingleModel($this, $name); }