setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; } /** * Find object by primary key. * Propel uses the instance pool to skip the database if the object exists. * Go fast if the query is untouched. * * * $obj = $c->findPk(12, $con); * * * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * * @return ChildEmailMessage|array|mixed the result, formatted by the current formatter */ public function findPk($key, ConnectionInterface $con = null) { throw new LogicException('The EmailMessage object has no primary key'); } /** * Find objects by primary key * * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); * * @param array $keys Primary keys to use for the query * @param ConnectionInterface $con an optional connection object * * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter */ public function findPks($keys, ConnectionInterface $con = null) { throw new LogicException('The EmailMessage object has no primary key'); } /** * Filter the query by primary key * * @param mixed $key Primary key to use for the query * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { throw new LogicException('The EmailMessage object has no primary key'); } /** * Filter the query by a list of primary keys * * @param array $keys The list of primary key to use for the query * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { throw new LogicException('The EmailMessage object has no primary key'); } /** * Filter the query on the recipient column * * Example usage: * * $query->filterByRecipient(1234); // WHERE recipient = 1234 * $query->filterByRecipient(array(12, 34)); // WHERE recipient IN (12, 34) * $query->filterByRecipient(array('min' => 12)); // WHERE recipient > 12 * * * @see filterByRecipientEmailAddress() * * @param mixed $recipient The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function filterByRecipient($recipient = null, $comparison = null) { if (is_array($recipient)) { $useMinMax = false; if (isset($recipient['min'])) { $this->addUsingAlias(EmailMessageTableMap::COL_RECIPIENT, $recipient['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($recipient['max'])) { $this->addUsingAlias(EmailMessageTableMap::COL_RECIPIENT, $recipient['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(EmailMessageTableMap::COL_RECIPIENT, $recipient, $comparison); } /** * Filter the query on the sender column * * Example usage: * * $query->filterBySender(1234); // WHERE sender = 1234 * $query->filterBySender(array(12, 34)); // WHERE sender IN (12, 34) * $query->filterBySender(array('min' => 12)); // WHERE sender > 12 * * * @see filterBySenderEmailAddress() * * @param mixed $sender The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function filterBySender($sender = null, $comparison = null) { if (is_array($sender)) { $useMinMax = false; if (isset($sender['min'])) { $this->addUsingAlias(EmailMessageTableMap::COL_SENDER, $sender['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($sender['max'])) { $this->addUsingAlias(EmailMessageTableMap::COL_SENDER, $sender['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(EmailMessageTableMap::COL_SENDER, $sender, $comparison); } /** * Filter the query on the contents column * * Example usage: * * $query->filterByContents('fooValue'); // WHERE contents = 'fooValue' * $query->filterByContents('%fooValue%'); // WHERE contents LIKE '%fooValue%' * * * @param string $contents The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function filterByContents($contents = null, $comparison = null) { if (null === $comparison) { if (is_array($contents)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $contents)) { $contents = str_replace('*', '%', $contents); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(EmailMessageTableMap::COL_CONTENTS, $contents, $comparison); } /** * Filter the query on the subject column * * Example usage: * * $query->filterBySubject('fooValue'); // WHERE subject = 'fooValue' * $query->filterBySubject('%fooValue%'); // WHERE subject LIKE '%fooValue%' * * * @param string $subject The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function filterBySubject($subject = null, $comparison = null) { if (null === $comparison) { if (is_array($subject)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $subject)) { $subject = str_replace('*', '%', $subject); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(EmailMessageTableMap::COL_SUBJECT, $subject, $comparison); } /** * Filter the query by a related \Eater\Glim\Model\EmailAddress object * * @param \Eater\Glim\Model\EmailAddress|ObjectCollection $emailAddress 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 ChildEmailMessageQuery The current query, for fluid interface */ public function filterByRecipientEmailAddress($emailAddress, $comparison = null) { if ($emailAddress instanceof \Eater\Glim\Model\EmailAddress) { return $this ->addUsingAlias(EmailMessageTableMap::COL_RECIPIENT, $emailAddress->getId(), $comparison); } elseif ($emailAddress instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this ->addUsingAlias(EmailMessageTableMap::COL_RECIPIENT, $emailAddress->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByRecipientEmailAddress() only accepts arguments of type \Eater\Glim\Model\EmailAddress or Collection'); } } /** * Adds a JOIN clause to the query using the RecipientEmailAddress relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function joinRecipientEmailAddress($relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('RecipientEmailAddress'); // create a ModelJoin object for this join $join = new ModelJoin(); $join->setJoinType($joinType); $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); if ($previousJoin = $this->getPreviousJoin()) { $join->setPreviousJoin($previousJoin); } // add the ModelJoin to the current object if ($relationAlias) { $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { $this->addJoinObject($join, 'RecipientEmailAddress'); } return $this; } /** * Use the RecipientEmailAddress relation EmailAddress object * * @see useQuery() * * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \Eater\Glim\Model\EmailAddressQuery A secondary query class using the current class as primary query */ public function useRecipientEmailAddressQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinRecipientEmailAddress($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'RecipientEmailAddress', '\Eater\Glim\Model\EmailAddressQuery'); } /** * Filter the query by a related \Eater\Glim\Model\EmailAddress object * * @param \Eater\Glim\Model\EmailAddress|ObjectCollection $emailAddress 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 ChildEmailMessageQuery The current query, for fluid interface */ public function filterBySenderEmailAddress($emailAddress, $comparison = null) { if ($emailAddress instanceof \Eater\Glim\Model\EmailAddress) { return $this ->addUsingAlias(EmailMessageTableMap::COL_SENDER, $emailAddress->getId(), $comparison); } elseif ($emailAddress instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this ->addUsingAlias(EmailMessageTableMap::COL_SENDER, $emailAddress->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterBySenderEmailAddress() only accepts arguments of type \Eater\Glim\Model\EmailAddress or Collection'); } } /** * Adds a JOIN clause to the query using the SenderEmailAddress relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function joinSenderEmailAddress($relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('SenderEmailAddress'); // create a ModelJoin object for this join $join = new ModelJoin(); $join->setJoinType($joinType); $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); if ($previousJoin = $this->getPreviousJoin()) { $join->setPreviousJoin($previousJoin); } // add the ModelJoin to the current object if ($relationAlias) { $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { $this->addJoinObject($join, 'SenderEmailAddress'); } return $this; } /** * Use the SenderEmailAddress relation EmailAddress object * * @see useQuery() * * @param string $relationAlias optional alias for the relation, * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return \Eater\Glim\Model\EmailAddressQuery A secondary query class using the current class as primary query */ public function useSenderEmailAddressQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinSenderEmailAddress($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'SenderEmailAddress', '\Eater\Glim\Model\EmailAddressQuery'); } /** * Exclude object from result * * @param ChildEmailMessage $emailMessage Object to remove from the list of results * * @return $this|ChildEmailMessageQuery The current query, for fluid interface */ public function prune($emailMessage = null) { if ($emailMessage) { throw new LogicException('EmailMessage object has no primary key'); } return $this; } /** * Deletes all rows from the email_message table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EmailMessageTableMap::DATABASE_NAME); } // use transaction because $criteria could contain info // for more than one table or we could emulating ON DELETE CASCADE, etc. return $con->transaction(function () use ($con) { $affectedRows = 0; // initialize var to track total num of affected rows $affectedRows += parent::doDeleteAll($con); // Because this db requires some delete cascade/set null emulation, we have to // clear the cached instance *after* the emulation has happened (since // instances get re-added by the select statement contained therein). EmailMessageTableMap::clearInstancePool(); EmailMessageTableMap::clearRelatedInstancePool(); return $affectedRows; }); } /** * Performs a DELETE on the database based on the current ModelCriteria * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public function delete(ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(EmailMessageTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName $criteria->setDbName(EmailMessageTableMap::DATABASE_NAME); // use transaction because $criteria could contain info // for more than one table or we could emulating ON DELETE CASCADE, etc. return $con->transaction(function () use ($con, $criteria) { $affectedRows = 0; // initialize var to track total num of affected rows EmailMessageTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); EmailMessageTableMap::clearRelatedInstancePool(); return $affectedRows; }); } } // EmailMessageQuery