/** * Declares an association between this object and a ChildAuthor object. * * @param ChildAuthor $v * @return $this|\testpropel\Book The current object (for fluent API support) * @throws PropelException */ public function setAuthor(ChildAuthor $v = null) { if ($v === null) { $this->setAuthorId(NULL); } else { $this->setAuthorId($v->getId()); } $this->aAuthor = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildAuthor object, it will not be re-added. if ($v !== null) { $v->addBook($this); } return $this; }
/** * Filter the query by a related \testpropel\Author object * * @param \testpropel\Author|ObjectCollection $author 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 ChildBookQuery The current query, for fluid interface */ public function filterByAuthor($author, $comparison = null) { if ($author instanceof \testpropel\Author) { return $this->addUsingAlias(BookTableMap::COL_AUTHOR_ID, $author->getId(), $comparison); } elseif ($author instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(BookTableMap::COL_AUTHOR_ID, $author->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByAuthor() only accepts arguments of type \\testpropel\\Author or Collection'); } }
/** * Exclude object from result * * @param ChildAuthor $author Object to remove from the list of results * * @return $this|ChildAuthorQuery The current query, for fluid interface */ public function prune($author = null) { if ($author) { $this->addUsingAlias(AuthorTableMap::COL_ID, $author->getId(), Criteria::NOT_EQUAL); } return $this; }