/** * Filter the query by a related \Book object * * @param \Book|ObjectCollection $book the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildAuthorQuery The current query, for fluid interface */ public function filterByBook($book, $comparison = null) { if ($book instanceof \Book) { return $this->addUsingAlias(AuthorTableMap::COL_ID, $book->getAuthorId(), $comparison); } elseif ($book instanceof ObjectCollection) { return $this->useBookQuery()->filterByPrimaryKeys($book->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByBook() only accepts arguments of type \\Book or Collection'); } }
/** * @param ChildBook $book The ChildBook object to add. */ protected function doAddBook(ChildBook $book) { $this->collBooks[] = $book; $book->setAuthor($this); }
/** * Filter the query by a related \Book object * * @param \Book|ObjectCollection $book The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * * @return ChildVerseQuery The current query, for fluid interface */ public function filterByBook($book, $comparison = null) { if ($book instanceof \Book) { return $this->addUsingAlias(VerseTableMap::COL_BOOK_ID, $book->getId(), $comparison); } elseif ($book instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(VerseTableMap::COL_BOOK_ID, $book->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByBook() only accepts arguments of type \\Book or Collection'); } }
/** * Exclude object from result * * @param ChildBook $book Object to remove from the list of results * * @return $this|ChildBookQuery The current query, for fluid interface */ public function prune($book = null) { if ($book) { $this->addUsingAlias(BookTableMap::COL_ID, $book->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Update the aggregate column in the related Book object * * @param ConnectionInterface $con A connection object */ protected function updateRelatedBookNumberOfVerses(ConnectionInterface $con) { if ($book = $this->getBook()) { $book->updateNumberOfVerses($con); } if ($this->oldBookNumberOfVerses) { $this->oldBookNumberOfVerses->updateNumberOfVerses($con); $this->oldBookNumberOfVerses = null; } }