Example #1
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aPublisher) {
         $this->aPublisher->removeBook($this);
     }
     if (null !== $this->aAuthor) {
         $this->aAuthor->removeBook($this);
     }
     $this->id = null;
     $this->title = null;
     $this->isbn = null;
     $this->publisher_id = null;
     $this->author_id = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #2
0
 /**
  * Filter the query by a related \testpropel\Publisher object
  *
  * @param \testpropel\Publisher|ObjectCollection $publisher 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 filterByPublisher($publisher, $comparison = null)
 {
     if ($publisher instanceof \testpropel\Publisher) {
         return $this->addUsingAlias(BookTableMap::COL_PUBLISHER_ID, $publisher->getId(), $comparison);
     } elseif ($publisher instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(BookTableMap::COL_PUBLISHER_ID, $publisher->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByPublisher() only accepts arguments of type \\testpropel\\Publisher or Collection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param   ChildPublisher $publisher Object to remove from the list of results
  *
  * @return $this|ChildPublisherQuery The current query, for fluid interface
  */
 public function prune($publisher = null)
 {
     if ($publisher) {
         $this->addUsingAlias(PublisherTableMap::COL_ID, $publisher->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }