/**
  * Join products and their URLs
  *
  * @param Criteria $query
  */
 protected function addJoinProduct(Criteria &$query)
 {
     // Join RewritingURL with Product to have only visible products
     $join = new Join();
     $join->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductTableMap::TABLE_NAME, 'ID', null);
     $join->setJoinType(Criteria::INNER_JOIN);
     $query->addJoinObject($join, 'productJoin');
     // Get only visible products
     $query->addJoinCondition('productJoin', ProductTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
 }
Example #2
0
 public function testCreateSelectSqlPart()
 {
     Propel::getServiceContainer()->setAdapter('oracle', new OracleAdapter());
     $db = Propel::getServiceContainer()->getAdapter();
     $c = new Criteria();
     $c->addSelectColumn(BookTableMap::COL_ID);
     $c->addAsColumn('book_ID', BookTableMap::COL_ID);
     $fromClause = [];
     $selectSql = $db->createSelectSqlPart($c, $fromClause);
     $this->assertEquals('SELECT book.id, book.id AS book_ID', $selectSql, 'createSelectSqlPart() returns a SQL SELECT clause with both select and as columns');
     $this->assertEquals(['book'], $fromClause, 'createSelectSqlPart() adds the tables from the select columns to the from clause');
 }
 public function testDoInsert()
 {
     try {
         $c = new Criteria();
         $c->setPrimaryTableName(BookTableMap::TABLE_NAME);
         $c->add(BookTableMap::AUTHOR_ID, 'lkhlkhj');
         $c->doInsert(Propel::getServiceContainer()->getWriteConnection(BookTableMap::DATABASE_NAME));
         $this->fail('Missing expected exception on BAD SQL');
     } catch (PropelException $e) {
         $this->assertContains('[INSERT INTO `book` (`AUTHOR_ID`) VALUES (:p1)]', $e->getMessage(), 'SQL query is written in the exception message');
     }
 }
 public function testAppendPsToCreatesAnInConditionUsingATableAlias()
 {
     $c = new Criteria();
     $c->addAlias('bar_alias', 'bar');
     $cton = new InCriterion($c, 'bar_alias.COL', array('foo'));
     $params = array();
     $ps = '';
     $cton->appendPsTo($ps, $params);
     $this->assertEquals('bar_alias.COL IN (:p1)', $ps);
     $expected = array(array('table' => 'bar', 'column' => 'COL', 'value' => 'foo'));
     $this->assertEquals($expected, $params);
 }
Example #5
0
 public function testClonedCriteriaNotAffected2()
 {
     $this->c->addCond('cond1', "INVOICE.COST1", "1000", Criteria::GREATER_EQUAL);
     $this->c->addCond('cond2', "INVOICE.COST2", "2000", Criteria::LESS_EQUAL);
     $this->c->combine(['cond1', 'cond2'], Criteria::LOGICAL_AND, 'cond12');
     $this->c->addCond('cond3', "INVOICE.COST3", "8000", Criteria::GREATER_EQUAL);
     $this->c->addCond('cond4', "INVOICE.COST4", "9000", Criteria::LESS_EQUAL);
     $this->c->combine(['cond3', 'cond4'], Criteria::LOGICAL_AND, 'cond34');
     $clonedCriteria = clone $this->c;
     $expect1 = $this->getSql("SELECT  FROM ");
     $params1 = [];
     $result1 = $this->c->createSelectSql($params1);
     $this->assertEquals($expect1, $result1);
     $this->c->addCond('cond5', "INVOICE.COST5", "5000", Criteria::GREATER_EQUAL);
     $this->c->combine(['cond34', 'cond5'], Criteria::LOGICAL_AND);
     $expect2 = $this->getSql("SELECT  FROM INVOICE WHERE ((INVOICE.COST3>=:p1 AND INVOICE.COST4<=:p2) AND INVOICE.COST5>=:p3)");
     $expect_params2 = [['table' => 'INVOICE', 'column' => 'COST3', 'value' => '8000'], ['table' => 'INVOICE', 'column' => 'COST4', 'value' => '9000'], ['table' => 'INVOICE', 'column' => 'COST5', 'value' => '5000']];
     $params2 = [];
     $result2 = $this->c->createSelectSql($params2);
     $this->assertEquals($expect2, $result2);
     $this->assertEquals($expect_params2, $params2);
     // Cloned criteria should not be affected by the combine of cond34 above
     // we should still be able to use it in the clone for another combine
     $clonedCriteria->combine(['cond12', 'cond34'], Criteria::LOGICAL_OR);
     $expect3 = $this->getSql("SELECT  FROM INVOICE WHERE ((INVOICE.COST1>=:p1 AND INVOICE.COST2<=:p2) OR (INVOICE.COST3>=:p3 AND INVOICE.COST4<=:p4))");
     $expect_params3 = [['table' => 'INVOICE', 'column' => 'COST1', 'value' => '1000'], ['table' => 'INVOICE', 'column' => 'COST2', 'value' => '2000'], ['table' => 'INVOICE', 'column' => 'COST3', 'value' => '8000'], ['table' => 'INVOICE', 'column' => 'COST4', 'value' => '9000']];
     $params3 = [];
     $result3 = $clonedCriteria->createSelectSql($params3);
     $this->assertEquals($expect3, $result3);
     $this->assertEquals($expect_params3, $params3);
 }
 /**
  * @param Criteria $criteria
  * @param string $alias
  */
 public function addSelectFields(Criteria $criteria, $alias = null)
 {
     if (null === $alias) {
         $criteria->addSelectField(AuthorEntityMap::COL_ID);
         $criteria->addSelectField(AuthorEntityMap::COL_FIRSTNAME);
         $criteria->addSelectField(AuthorEntityMap::COL_LASTNAME);
         $criteria->addSelectField(AuthorEntityMap::COL_EMAIL);
     } else {
         $criteria->addSelectField($alias . '.id');
         $criteria->addSelectField($alias . '.firstName');
         $criteria->addSelectField($alias . '.lastName');
         $criteria->addSelectField($alias . '.email');
     }
 }
 public function testDoInsert()
 {
     $con = Propel::getServiceContainer()->getWriteConnection(BookTableMap::DATABASE_NAME);
     try {
         $c = new Criteria();
         $c->setPrimaryTableName(BookTableMap::TABLE_NAME);
         $c->add(BookTableMap::AUTHOR_ID, 'lkhlkhj');
         $db = Propel::getServiceContainer()->getAdapter($c->getDbName());
         $c->doInsert($con);
         $this->fail('Missing expected exception on BAD SQL');
     } catch (PropelException $e) {
         if ($db->isGetIdBeforeInsert()) {
             $this->assertContains($this->getSql('[INSERT INTO book (AUTHOR_ID,ID) VALUES (:p1,:p2)]'), $e->getMessage(), 'SQL query is written in the exception message');
         } else {
             $this->assertContains($this->getSql('[INSERT INTO `book` (`AUTHOR_ID`) VALUES (:p1)]'), $e->getMessage(), 'SQL query is written in the exception message');
         }
     }
 }
 public function testDoSelectOrderByRank()
 {
     $c = new Criteria();
     $c->add(SortableTable12TableMap::SCOPE_COL, 1);
     $objects = SortableTable12Query::doSelectOrderByRank($c)->getArrayCopy();
     $oldRank = 0;
     while ($object = array_shift($objects)) {
         $this->assertTrue($object->getRank() > $oldRank);
         $oldRank = $object->getRank();
     }
     $c = new Criteria();
     $c->add(SortableTable12TableMap::SCOPE_COL, 1);
     $objects = SortableTable12Query::doSelectOrderByRank($c, Criteria::DESC)->getArrayCopy();
     $oldRank = 10;
     while ($object = array_shift($objects)) {
         $this->assertTrue($object->getRank() < $oldRank);
         $oldRank = $object->getRank();
     }
 }
 /**
  * Init some properties with the help of outer class
  * @param      Criteria $criteria The outer class
  */
 public function init(Criteria $criteria)
 {
     try {
         $db = Propel::getServiceContainer()->getAdapter($criteria->getDbName());
         $this->setAdapter($db);
     } catch (\Exception $e) {
         // we are only doing this to allow easier debugging, so
         // no need to throw up the exception, just make note of it.
         Propel::log("Could not get a AdapterInterface, sql may be wrong", Propel::LOG_ERR);
     }
     // init $this->realtable
     $realtable = $criteria->getTableForAlias($this->table);
     $this->realtable = $realtable ? $realtable : $this->table;
 }
Example #10
0
 public function testCombineDirtyOperators()
 {
     $this->c->addCond('cond1', "INVOICE.COST1", "1000", Criteria::GREATER_EQUAL);
     $this->c->addCond('cond2', "INVOICE.COST2", "2000", Criteria::LESS_EQUAL);
     $this->c->combine(['cond1', 'cond2'], 'AnD', 'cond12');
     $this->c->addCond('cond3', "INVOICE.COST3", "8000", Criteria::GREATER_EQUAL);
     $this->c->addCond('cond4', "INVOICE.COST4", "9000", Criteria::LESS_EQUAL);
     $this->c->combine(['cond3', 'cond4'], 'aNd', 'cond34');
     $this->c->combine(['cond12', 'cond34'], 'oR');
     $expect = $this->getSql("SELECT  FROM INVOICE WHERE ((INVOICE.COST1>=:p1 AND INVOICE.COST2<=:p2) OR (INVOICE.COST3>=:p3 AND INVOICE.COST4<=:p4))");
     $expect_params = [['table' => 'INVOICE', 'column' => 'COST1', 'value' => '1000'], ['table' => 'INVOICE', 'column' => 'COST2', 'value' => '2000'], ['table' => 'INVOICE', 'column' => 'COST3', 'value' => '8000'], ['table' => 'INVOICE', 'column' => 'COST4', 'value' => '9000']];
     $params = [];
     $result = $this->c->createSelectSql($params);
     $this->assertEquals($expect, $result);
     $this->assertEquals($expect_params, $params);
 }
Example #11
0
 /**
  * @inheritdoc
  */
 public function toCriteria()
 {
     $criteria = new Criteria();
     if ($this->filterTransfer->getLimit() !== null) {
         $criteria->setLimit($this->filterTransfer->getLimit());
     }
     if ($this->filterTransfer->getOffset() !== null) {
         $criteria->setOffset($this->filterTransfer->getOffset());
     }
     if ($this->filterTransfer->getOrderBy() !== null) {
         if ($this->filterTransfer->getOrderDirection() === 'ASC') {
             $criteria->addAscendingOrderByColumn($this->filterTransfer->getOrderBy());
         } elseif ($this->filterTransfer->getOrderDirection() === 'DESC') {
             $criteria->addDescendingOrderByColumn($this->filterTransfer->getOrderBy());
         }
     }
     return $criteria;
 }
 /**
  * Join products and their URLs
  *
  * @param Criteria $query
  */
 protected function addJoinProductI18n(Criteria &$query)
 {
     // Join RewritingURL with Product to have only visible products
     $join = new Join();
     $join->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductTableMap::TABLE_NAME, 'ID', null);
     $join->setJoinType(Criteria::INNER_JOIN);
     $query->addJoinObject($join, 'productJoin');
     $query->addJoinCondition('productJoin', ProductTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
     // Join RewritingURL with ProductI18n to have product title for it's image
     $joinI18n = new Join();
     $joinI18n->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductI18nTableMap::TABLE_NAME, 'ID', null);
     $joinI18n->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_LOCALE', null, ProductI18nTableMap::TABLE_NAME, 'LOCALE', null);
     $joinI18n->setJoinType(Criteria::INNER_JOIN);
     $query->addJoinObject($joinI18n);
     // Join RewritingURL with ProductImage to have image file
     $joinImage = new Join();
     $joinImage->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'VIEW_ID', null, ProductImageTableMap::TABLE_NAME, 'PRODUCT_ID', null);
     $joinImage->setJoinType(Criteria::INNER_JOIN);
     $query->addJoinObject($joinImage, 'productImageJoin');
     $query->addJoinCondition('productImageJoin', ProductImageTableMap::VISIBLE, 1, Criteria::EQUAL, \PDO::PARAM_INT);
 }
Example #13
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(CustomerTitleI18nTableMap::DATABASE_NAME);
     $criteria->add(CustomerTitleI18nTableMap::ID, $this->id);
     $criteria->add(CustomerTitleI18nTableMap::LOCALE, $this->locale);
     return $criteria;
 }
Example #14
0
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(WishlistProductTableMap::DATABASE_NAME);
     if ($this->isColumnModified(WishlistProductTableMap::COL_WISHLIST_PRODUCT_ID)) {
         $criteria->add(WishlistProductTableMap::COL_WISHLIST_PRODUCT_ID, $this->wishlist_product_id);
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_WISHLIST_ID)) {
         $criteria->add(WishlistProductTableMap::COL_WISHLIST_ID, $this->wishlist_id);
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_PRODUCT_ID)) {
         $criteria->add(WishlistProductTableMap::COL_PRODUCT_ID, $this->product_id);
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_WISHLIST_PRODUCT_COMMENT)) {
         $criteria->add(WishlistProductTableMap::COL_WISHLIST_PRODUCT_COMMENT, $this->wishlist_product_comment);
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_CREATED_AT)) {
         $criteria->add(WishlistProductTableMap::COL_CREATED_AT, $this->created_at);
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_UPDATED_AT)) {
         $criteria->add(WishlistProductTableMap::COL_UPDATED_AT, $this->updated_at);
     }
     return $criteria;
 }
Example #15
0
 public function testCreateSelectSqlPartAliasAll()
 {
     $db = Propel::getServiceContainer()->getAdapter(BookTableMap::DATABASE_NAME);
     $c = new Criteria();
     $c->addSelectColumn(BookTableMap::COL_ID);
     $c->addAsColumn('book_id', BookTableMap::COL_ID);
     $fromClause = [];
     $selectSql = $db->createSelectSqlPart($c, $fromClause, true);
     $this->assertEquals('SELECT book.id AS book_id_1, book.id AS book_id', $selectSql, 'createSelectSqlPart() aliases all columns if passed true as last parameter');
     $this->assertEquals([], $fromClause, 'createSelectSqlPart() does not add the tables from an all-aliased list of select columns');
 }
Example #16
0
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(FileTableMap::DATABASE_NAME);
     if ($this->isColumnModified(FileTableMap::COL_FILE_ID)) {
         $criteria->add(FileTableMap::COL_FILE_ID, $this->file_id);
     }
     if ($this->isColumnModified(FileTableMap::COL_FILE_TYPE_ID)) {
         $criteria->add(FileTableMap::COL_FILE_TYPE_ID, $this->file_type_id);
     }
     if ($this->isColumnModified(FileTableMap::COL_FILE_PATH)) {
         $criteria->add(FileTableMap::COL_FILE_PATH, $this->file_path);
     }
     if ($this->isColumnModified(FileTableMap::COL_CREATED_AT)) {
         $criteria->add(FileTableMap::COL_CREATED_AT, $this->created_at);
     }
     if ($this->isColumnModified(FileTableMap::COL_UPDATED_AT)) {
         $criteria->add(FileTableMap::COL_UPDATED_AT, $this->updated_at);
     }
     return $criteria;
 }
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(EntityTypeTableMap::DATABASE_NAME);
     if ($this->isColumnModified(EntityTypeTableMap::COL_ID)) {
         $criteria->add(EntityTypeTableMap::COL_ID, $this->id);
     }
     if ($this->isColumnModified(EntityTypeTableMap::COL_NAME)) {
         $criteria->add(EntityTypeTableMap::COL_NAME, $this->name);
     }
     return $criteria;
 }
 public function doTestReplaceNames(Criteria $c, $tableMap, $origClause, $columnPhpName = false, $modifiedClause)
 {
     $c->replaceNames($origClause);
     $columns = $c->replacedColumns;
     if ($columnPhpName) {
         $this->assertEquals(array($tableMap->getColumnByPhpName($columnPhpName)), $columns);
     }
     $this->assertEquals($modifiedClause, $origClause);
 }
Example #19
0
 /**
  * Performs a DELETE on the database, given a ModuleImage or Criteria object OR a primary key value.
  *
  * @param mixed               $values Criteria or ModuleImage object or primary key or array of primary keys
  *              which is used to create the DELETE statement
  * @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 static function doDelete($values, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(ModuleImageTableMap::DATABASE_NAME);
     }
     if ($values instanceof Criteria) {
         // rename for clarity
         $criteria = $values;
     } elseif ($values instanceof \Thelia\Model\ModuleImage) {
         // it's a model object
         // create criteria based on pk values
         $criteria = $values->buildPkeyCriteria();
     } else {
         // it's a primary key, or an array of pks
         $criteria = new Criteria(ModuleImageTableMap::DATABASE_NAME);
         $criteria->add(ModuleImageTableMap::ID, (array) $values, Criteria::IN);
     }
     $query = ModuleImageQuery::create()->mergeWith($criteria);
     if ($values instanceof Criteria) {
         ModuleImageTableMap::clearInstancePool();
     } elseif (!is_object($values)) {
         // it's a primary key, or an array of pks
         foreach ((array) $values as $singleval) {
             ModuleImageTableMap::removeInstanceFromPool($singleval);
         }
     }
     return $query->delete($con);
 }
 /**
  * Performs a DELETE on the database, given a DiaporamaVersion or Criteria object OR a primary key value.
  *
  * @param mixed               $values Criteria or DiaporamaVersion object or primary key or array of primary keys
  *              which is used to create the DELETE statement
  * @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 static function doDelete($values, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(DiaporamaVersionTableMap::DATABASE_NAME);
     }
     if ($values instanceof Criteria) {
         // rename for clarity
         $criteria = $values;
     } elseif ($values instanceof \Diaporamas\Model\DiaporamaVersion) {
         // it's a model object
         // create criteria based on pk values
         $criteria = $values->buildPkeyCriteria();
     } else {
         // it's a primary key, or an array of pks
         $criteria = new Criteria(DiaporamaVersionTableMap::DATABASE_NAME);
         // primary key is composite; we therefore, expect
         // the primary key passed to be an array of pkey values
         if (count($values) == count($values, COUNT_RECURSIVE)) {
             // array is not multi-dimensional
             $values = array($values);
         }
         foreach ($values as $value) {
             $criterion = $criteria->getNewCriterion(DiaporamaVersionTableMap::ID, $value[0]);
             $criterion->addAnd($criteria->getNewCriterion(DiaporamaVersionTableMap::VERSION, $value[1]));
             $criteria->addOr($criterion);
         }
     }
     $query = DiaporamaVersionQuery::create()->mergeWith($criteria);
     if ($values instanceof Criteria) {
         DiaporamaVersionTableMap::clearInstancePool();
     } elseif (!is_object($values)) {
         // it's a primary key, or an array of pks
         foreach ((array) $values as $singleval) {
             DiaporamaVersionTableMap::removeInstanceFromPool($singleval);
         }
     }
     return $query->delete($con);
 }
Example #21
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(CommentTableMap::DATABASE_NAME);
     $criteria->add(CommentTableMap::ID, $this->id);
     return $criteria;
 }
Example #22
0
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(ApplicationTableMap::DATABASE_NAME);
     if ($this->isColumnModified(ApplicationTableMap::COL_ID)) {
         $criteria->add(ApplicationTableMap::COL_ID, $this->id);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_STUDENT_ID)) {
         $criteria->add(ApplicationTableMap::COL_STUDENT_ID, $this->student_id);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_SUBJECT_ID)) {
         $criteria->add(ApplicationTableMap::COL_SUBJECT_ID, $this->subject_id);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_PERIOD_ID)) {
         $criteria->add(ApplicationTableMap::COL_PERIOD_ID, $this->period_id);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_SCHOOL_YEAR_ID)) {
         $criteria->add(ApplicationTableMap::COL_SCHOOL_YEAR_ID, $this->school_year_id);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_APPLICATION_DATE)) {
         $criteria->add(ApplicationTableMap::COL_APPLICATION_DATE, $this->application_date);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_EXAM_DATE)) {
         $criteria->add(ApplicationTableMap::COL_EXAM_DATE, $this->exam_date);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_EXAM_TIME)) {
         $criteria->add(ApplicationTableMap::COL_EXAM_TIME, $this->exam_time);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_EXAM_SCORE)) {
         $criteria->add(ApplicationTableMap::COL_EXAM_SCORE, $this->exam_score);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_CREATED_AT)) {
         $criteria->add(ApplicationTableMap::COL_CREATED_AT, $this->created_at);
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_UPDATED_AT)) {
         $criteria->add(ApplicationTableMap::COL_UPDATED_AT, $this->updated_at);
     }
     return $criteria;
 }
Example #23
0
 public function testModifiedObjectsRemainInTheCollection()
 {
     $c = new Criteria();
     $c->add(BookTableMap::ID, $this->books[0]->getId());
     $books = BookQuery::create(null, $c)->joinWithAuthor()->find();
     $books[0]->setTitle('Modified');
     $books2 = $books[0]->getAuthor()->getBooks();
     $this->assertEquals(2, count($books2));
     $this->assertEquals(2, $books2[0]->getAuthor()->countBooks());
     $this->assertEquals('Modified', $books2[0]->getTitle());
 }
Example #24
0
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(StudentTableMap::DATABASE_NAME);
     if ($this->isColumnModified(StudentTableMap::COL_ID)) {
         $criteria->add(StudentTableMap::COL_ID, $this->id);
     }
     if ($this->isColumnModified(StudentTableMap::COL_IDENTIFICATION_NUMBER)) {
         $criteria->add(StudentTableMap::COL_IDENTIFICATION_NUMBER, $this->identification_number);
     }
     if ($this->isColumnModified(StudentTableMap::COL_SCHOOL_YEAR_ID)) {
         $criteria->add(StudentTableMap::COL_SCHOOL_YEAR_ID, $this->school_year_id);
     }
     if ($this->isColumnModified(StudentTableMap::COL_COURSE_ID)) {
         $criteria->add(StudentTableMap::COL_COURSE_ID, $this->course_id);
     }
     if ($this->isColumnModified(StudentTableMap::COL_FIRST_NAME)) {
         $criteria->add(StudentTableMap::COL_FIRST_NAME, $this->first_name);
     }
     if ($this->isColumnModified(StudentTableMap::COL_LAST_NAME)) {
         $criteria->add(StudentTableMap::COL_LAST_NAME, $this->last_name);
     }
     if ($this->isColumnModified(StudentTableMap::COL_BIRTH_PLACE)) {
         $criteria->add(StudentTableMap::COL_BIRTH_PLACE, $this->birth_place);
     }
     if ($this->isColumnModified(StudentTableMap::COL_BIRTHDAY)) {
         $criteria->add(StudentTableMap::COL_BIRTHDAY, $this->birthday);
     }
     if ($this->isColumnModified(StudentTableMap::COL_PHONE_NUMBER)) {
         $criteria->add(StudentTableMap::COL_PHONE_NUMBER, $this->phone_number);
     }
     if ($this->isColumnModified(StudentTableMap::COL_CREATED_AT)) {
         $criteria->add(StudentTableMap::COL_CREATED_AT, $this->created_at);
     }
     if ($this->isColumnModified(StudentTableMap::COL_UPDATED_AT)) {
         $criteria->add(StudentTableMap::COL_UPDATED_AT, $this->updated_at);
     }
     return $criteria;
 }
Example #25
0
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(JaCategoriasTableMap::DATABASE_NAME);
     if ($this->isColumnModified(JaCategoriasTableMap::COL_ID)) {
         $criteria->add(JaCategoriasTableMap::COL_ID, $this->id);
     }
     if ($this->isColumnModified(JaCategoriasTableMap::COL_TITULO)) {
         $criteria->add(JaCategoriasTableMap::COL_TITULO, $this->titulo);
     }
     if ($this->isColumnModified(JaCategoriasTableMap::COL_SLUG)) {
         $criteria->add(JaCategoriasTableMap::COL_SLUG, $this->slug);
     }
     return $criteria;
 }
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(JaPaginaCategoriasTableMap::DATABASE_NAME);
     if ($this->isColumnModified(JaPaginaCategoriasTableMap::COL_ID)) {
         $criteria->add(JaPaginaCategoriasTableMap::COL_ID, $this->id);
     }
     if ($this->isColumnModified(JaPaginaCategoriasTableMap::COL_ID_PAGINA)) {
         $criteria->add(JaPaginaCategoriasTableMap::COL_ID_PAGINA, $this->id_pagina);
     }
     if ($this->isColumnModified(JaPaginaCategoriasTableMap::COL_ID_CATEGORIA)) {
         $criteria->add(JaPaginaCategoriasTableMap::COL_ID_CATEGORIA, $this->id_categoria);
     }
     return $criteria;
 }
Example #27
0
 /**
  * Gets all the versions of this object, in incremental order
  *
  * @param   ConnectionInterface $con the connection to use
  *
  * @return  ObjectCollection A list of ChildContentVersion objects
  */
 public function getAllVersions($con = null)
 {
     $criteria = new Criteria();
     $criteria->addAscendingOrderByColumn(ContentVersionTableMap::VERSION);
     return $this->getContentVersions($criteria, $con);
 }
Example #28
0
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(SessionTableMap::DATABASE_NAME);
     if ($this->isColumnModified(SessionTableMap::COL_TOKEN)) {
         $criteria->add(SessionTableMap::COL_TOKEN, $this->token);
     }
     if ($this->isColumnModified(SessionTableMap::COL_USER_ID)) {
         $criteria->add(SessionTableMap::COL_USER_ID, $this->user_id);
     }
     if ($this->isColumnModified(SessionTableMap::COL_IP)) {
         $criteria->add(SessionTableMap::COL_IP, $this->ip);
     }
     if ($this->isColumnModified(SessionTableMap::COL_USER_AGENT)) {
         $criteria->add(SessionTableMap::COL_USER_AGENT, $this->user_agent);
     }
     if ($this->isColumnModified(SessionTableMap::COL_BROWSER)) {
         $criteria->add(SessionTableMap::COL_BROWSER, $this->browser);
     }
     if ($this->isColumnModified(SessionTableMap::COL_DEVICE)) {
         $criteria->add(SessionTableMap::COL_DEVICE, $this->device);
     }
     if ($this->isColumnModified(SessionTableMap::COL_OS)) {
         $criteria->add(SessionTableMap::COL_OS, $this->os);
     }
     if ($this->isColumnModified(SessionTableMap::COL_LOCATION)) {
         $criteria->add(SessionTableMap::COL_LOCATION, $this->location);
     }
     if ($this->isColumnModified(SessionTableMap::COL_CREATED_AT)) {
         $criteria->add(SessionTableMap::COL_CREATED_AT, $this->created_at);
     }
     if ($this->isColumnModified(SessionTableMap::COL_UPDATED_AT)) {
         $criteria->add(SessionTableMap::COL_UPDATED_AT, $this->updated_at);
     }
     return $criteria;
 }
Example #29
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(CouponVersionTableMap::DATABASE_NAME);
     $criteria->add(CouponVersionTableMap::ID, $this->id);
     $criteria->add(CouponVersionTableMap::VERSION, $this->version);
     return $criteria;
 }
Example #30
0
 /**
  * Build a Criteria object containing the values of all modified columns in this object.
  *
  * @return Criteria The Criteria object containing all modified values.
  */
 public function buildCriteria()
 {
     $criteria = new Criteria(DataTableMap::DATABASE_NAME);
     if ($this->isColumnModified(DataTableMap::COL_ID)) {
         $criteria->add(DataTableMap::COL_ID, $this->id);
     }
     if ($this->isColumnModified(DataTableMap::COL__FORCONTRIBUTION)) {
         $criteria->add(DataTableMap::COL__FORCONTRIBUTION, $this->_forcontribution);
     }
     if ($this->isColumnModified(DataTableMap::COL__FORTEMPLATEFIELD)) {
         $criteria->add(DataTableMap::COL__FORTEMPLATEFIELD, $this->_fortemplatefield);
     }
     if ($this->isColumnModified(DataTableMap::COL__CONTENT)) {
         $criteria->add(DataTableMap::COL__CONTENT, $this->_content);
     }
     if ($this->isColumnModified(DataTableMap::COL__ISJSON)) {
         $criteria->add(DataTableMap::COL__ISJSON, $this->_isjson);
     }
     if ($this->isColumnModified(DataTableMap::COL___USER__)) {
         $criteria->add(DataTableMap::COL___USER__, $this->__user__);
     }
     if ($this->isColumnModified(DataTableMap::COL___CONFIG__)) {
         $criteria->add(DataTableMap::COL___CONFIG__, $this->__config__);
     }
     if ($this->isColumnModified(DataTableMap::COL___SPLIT__)) {
         $criteria->add(DataTableMap::COL___SPLIT__, $this->__split__);
     }
     if ($this->isColumnModified(DataTableMap::COL___PARENTNODE__)) {
         $criteria->add(DataTableMap::COL___PARENTNODE__, $this->__parentnode__);
     }
     if ($this->isColumnModified(DataTableMap::COL___SORT__)) {
         $criteria->add(DataTableMap::COL___SORT__, $this->__sort__);
     }
     return $criteria;
 }