/** * Filter the query by a related \WineTasting\Model\Wine object * * @param \WineTasting\Model\Wine|ObjectCollection $wine the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildUserQuery The current query, for fluid interface */ public function filterByWineRelatedBySubmitter($wine, $comparison = null) { if ($wine instanceof \WineTasting\Model\Wine) { return $this->addUsingAlias(UserTableMap::COL_IDUSER, $wine->getSubmitter(), $comparison); } elseif ($wine instanceof ObjectCollection) { return $this->useWineRelatedBySubmitterQuery()->filterByPrimaryKeys($wine->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByWineRelatedBySubmitter() only accepts arguments of type \\WineTasting\\Model\\Wine or Collection'); } }
private function createWineDto(Wine $wine) { $submitter = UserQuery::create()->findOneByIdUser($wine->getSubmitter()); return ['id' => $wine->getIdWine(), 'name' => $wine->getName(), 'submitter' => $submitter->getName(), 'points' => $this->calculatePoints($wine), 'picture' => $wine->getPicture(), 'year' => $wine->getYear()]; }