コード例 #1
0
 /**
  * Filter the query by a related Principal object
  *
  * @param   Principal|PropelObjectCollection $principal The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 PrincipalI18nQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPrincipal($principal, $comparison = null)
 {
     if ($principal instanceof Principal) {
         return $this->addUsingAlias(PrincipalI18nPeer::ID, $principal->getId(), $comparison);
     } elseif ($principal instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(PrincipalI18nPeer::ID, $principal->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByPrincipal() only accepts arguments of type Principal or PropelCollection');
     }
 }