/**
  * 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;
 }
Exemple #3
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);
 }
<?php

// setup auto-loading
require __DIR__ . '/vendor/autoload.php';
// setup propel
require __DIR__ . '/generated-conf/config.php';
use testpropel\Author;
$author = new Author();
$author->setFirstName('Jeff');
$author->setLastName('Black');
$author->save();