Example #1
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildTip A model object, or null if the key is not found
  */
 protected function findPkSimple($key, ConnectionInterface $con)
 {
     $sql = 'SELECT id, bet, toto, joker, extra_joker, points, match_id, player_id FROM tips WHERE id = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         /** @var ChildTip $obj */
         $obj = new ChildTip();
         $obj->hydrate($row);
         TipTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #2
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[ContentTableMap::ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ContentTableMap::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(ContentTableMap::ID)) {
         $modifiedColumns[':p' . $index++] = '`ID`';
     }
     if ($this->isColumnModified(ContentTableMap::VISIBLE)) {
         $modifiedColumns[':p' . $index++] = '`VISIBLE`';
     }
     if ($this->isColumnModified(ContentTableMap::POSITION)) {
         $modifiedColumns[':p' . $index++] = '`POSITION`';
     }
     if ($this->isColumnModified(ContentTableMap::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
     }
     if ($this->isColumnModified(ContentTableMap::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
     }
     if ($this->isColumnModified(ContentTableMap::VERSION)) {
         $modifiedColumns[':p' . $index++] = '`VERSION`';
     }
     if ($this->isColumnModified(ContentTableMap::VERSION_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
     }
     if ($this->isColumnModified(ContentTableMap::VERSION_CREATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
     }
     $sql = sprintf('INSERT INTO `content` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`VISIBLE`':
                     $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT);
                     break;
                 case '`POSITION`':
                     $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
                     break;
                 case '`CREATED_AT`':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`UPDATED_AT`':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`VERSION`':
                     $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
                     break;
                 case '`VERSION_CREATED_AT`':
                     $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`VERSION_CREATED_BY`':
                     $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildGoogleshoppingProductSynchronisation A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT ID, PRODUCT_ID, TARGET_COUNTRY, LANG, SYNC_ENABLE, GOOGLESHOPPING_ACCOUNT_ID FROM googleshopping_product_synchronisation WHERE ID = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildGoogleshoppingProductSynchronisation();
         $obj->hydrate($row);
         GoogleshoppingProductSynchronisationTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #4
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[CommentTableMap::ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . CommentTableMap::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(CommentTableMap::ID)) {
         $modifiedColumns[':p' . $index++] = 'ID';
     }
     if ($this->isColumnModified(CommentTableMap::USERNAME)) {
         $modifiedColumns[':p' . $index++] = 'USERNAME';
     }
     if ($this->isColumnModified(CommentTableMap::CUSTOMER_ID)) {
         $modifiedColumns[':p' . $index++] = 'CUSTOMER_ID';
     }
     if ($this->isColumnModified(CommentTableMap::REF)) {
         $modifiedColumns[':p' . $index++] = 'REF';
     }
     if ($this->isColumnModified(CommentTableMap::REF_ID)) {
         $modifiedColumns[':p' . $index++] = 'REF_ID';
     }
     if ($this->isColumnModified(CommentTableMap::EMAIL)) {
         $modifiedColumns[':p' . $index++] = 'EMAIL';
     }
     if ($this->isColumnModified(CommentTableMap::TITLE)) {
         $modifiedColumns[':p' . $index++] = 'TITLE';
     }
     if ($this->isColumnModified(CommentTableMap::CONTENT)) {
         $modifiedColumns[':p' . $index++] = 'CONTENT';
     }
     if ($this->isColumnModified(CommentTableMap::RATING)) {
         $modifiedColumns[':p' . $index++] = 'RATING';
     }
     if ($this->isColumnModified(CommentTableMap::STATUS)) {
         $modifiedColumns[':p' . $index++] = 'STATUS';
     }
     if ($this->isColumnModified(CommentTableMap::VERIFIED)) {
         $modifiedColumns[':p' . $index++] = 'VERIFIED';
     }
     if ($this->isColumnModified(CommentTableMap::ABUSE)) {
         $modifiedColumns[':p' . $index++] = 'ABUSE';
     }
     if ($this->isColumnModified(CommentTableMap::LOCALE)) {
         $modifiedColumns[':p' . $index++] = 'LOCALE';
     }
     if ($this->isColumnModified(CommentTableMap::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'CREATED_AT';
     }
     if ($this->isColumnModified(CommentTableMap::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
     }
     $sql = sprintf('INSERT INTO comment (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'ID':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case 'USERNAME':
                     $stmt->bindValue($identifier, $this->username, PDO::PARAM_STR);
                     break;
                 case 'CUSTOMER_ID':
                     $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT);
                     break;
                 case 'REF':
                     $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
                     break;
                 case 'REF_ID':
                     $stmt->bindValue($identifier, $this->ref_id, PDO::PARAM_INT);
                     break;
                 case 'EMAIL':
                     $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR);
                     break;
                 case 'TITLE':
                     $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
                     break;
                 case 'CONTENT':
                     $stmt->bindValue($identifier, $this->content, PDO::PARAM_STR);
                     break;
                 case 'RATING':
                     $stmt->bindValue($identifier, $this->rating, PDO::PARAM_INT);
                     break;
                 case 'STATUS':
                     $stmt->bindValue($identifier, $this->status, PDO::PARAM_INT);
                     break;
                 case 'VERIFIED':
                     $stmt->bindValue($identifier, $this->verified, PDO::PARAM_INT);
                     break;
                 case 'ABUSE':
                     $stmt->bindValue($identifier, $this->abuse, PDO::PARAM_INT);
                     break;
                 case 'LOCALE':
                     $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
                     break;
                 case 'CREATED_AT':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'UPDATED_AT':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
Example #5
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildPeople A model object, or null if the key is not found
  */
 protected function findPkSimple($key, ConnectionInterface $con)
 {
     $sql = 'SELECT id, name, date, city, street, fix_text, normal, company FROM people WHERE id = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         /** @var ChildPeople $obj */
         $obj = new ChildPeople();
         $obj->hydrate($row);
         PeopleTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #6
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[WishlistProductTableMap::COL_WISHLIST_PRODUCT_ID] = true;
     if (null !== $this->wishlist_product_id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . WishlistProductTableMap::COL_WISHLIST_PRODUCT_ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(WishlistProductTableMap::COL_WISHLIST_PRODUCT_ID)) {
         $modifiedColumns[':p' . $index++] = 'wishlist_product_id';
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_WISHLIST_ID)) {
         $modifiedColumns[':p' . $index++] = 'wishlist_id';
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_PRODUCT_ID)) {
         $modifiedColumns[':p' . $index++] = 'product_id';
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_WISHLIST_PRODUCT_COMMENT)) {
         $modifiedColumns[':p' . $index++] = 'wishlist_product_comment';
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'created_at';
     }
     if ($this->isColumnModified(WishlistProductTableMap::COL_UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'updated_at';
     }
     $sql = sprintf('INSERT INTO wishlist_product (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'wishlist_product_id':
                     $stmt->bindValue($identifier, $this->wishlist_product_id, PDO::PARAM_INT);
                     break;
                 case 'wishlist_id':
                     $stmt->bindValue($identifier, $this->wishlist_id, PDO::PARAM_INT);
                     break;
                 case 'product_id':
                     $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT);
                     break;
                 case 'wishlist_product_comment':
                     $stmt->bindValue($identifier, $this->wishlist_product_comment, PDO::PARAM_STR);
                     break;
                 case 'created_at':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'updated_at':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setWishlistProductId($pk);
     $this->setNew(false);
 }
Example #7
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[ApplicationTableMap::COL_ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ApplicationTableMap::COL_ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(ApplicationTableMap::COL_ID)) {
         $modifiedColumns[':p' . $index++] = 'id';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_STUDENT_ID)) {
         $modifiedColumns[':p' . $index++] = 'student_id';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_SUBJECT_ID)) {
         $modifiedColumns[':p' . $index++] = 'subject_id';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_PERIOD_ID)) {
         $modifiedColumns[':p' . $index++] = 'period_id';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_SCHOOL_YEAR_ID)) {
         $modifiedColumns[':p' . $index++] = 'school_year_id';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_APPLICATION_DATE)) {
         $modifiedColumns[':p' . $index++] = 'application_date';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_EXAM_DATE)) {
         $modifiedColumns[':p' . $index++] = 'exam_date';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_EXAM_TIME)) {
         $modifiedColumns[':p' . $index++] = 'exam_time';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_EXAM_SCORE)) {
         $modifiedColumns[':p' . $index++] = 'exam_score';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'created_at';
     }
     if ($this->isColumnModified(ApplicationTableMap::COL_UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'updated_at';
     }
     $sql = sprintf('INSERT INTO application (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'id':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case 'student_id':
                     $stmt->bindValue($identifier, $this->student_id, PDO::PARAM_INT);
                     break;
                 case 'subject_id':
                     $stmt->bindValue($identifier, $this->subject_id, PDO::PARAM_INT);
                     break;
                 case 'period_id':
                     $stmt->bindValue($identifier, $this->period_id, PDO::PARAM_INT);
                     break;
                 case 'school_year_id':
                     $stmt->bindValue($identifier, $this->school_year_id, PDO::PARAM_INT);
                     break;
                 case 'application_date':
                     $stmt->bindValue($identifier, $this->application_date ? $this->application_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'exam_date':
                     $stmt->bindValue($identifier, $this->exam_date ? $this->exam_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'exam_time':
                     $stmt->bindValue($identifier, $this->exam_time ? $this->exam_time->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'exam_score':
                     $stmt->bindValue($identifier, $this->exam_score, PDO::PARAM_INT);
                     break;
                 case 'created_at':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'updated_at':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
Example #8
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(ModuleImageI18nTableMap::ID)) {
         $modifiedColumns[':p' . $index++] = '`ID`';
     }
     if ($this->isColumnModified(ModuleImageI18nTableMap::LOCALE)) {
         $modifiedColumns[':p' . $index++] = '`LOCALE`';
     }
     if ($this->isColumnModified(ModuleImageI18nTableMap::TITLE)) {
         $modifiedColumns[':p' . $index++] = '`TITLE`';
     }
     if ($this->isColumnModified(ModuleImageI18nTableMap::DESCRIPTION)) {
         $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
     }
     if ($this->isColumnModified(ModuleImageI18nTableMap::CHAPO)) {
         $modifiedColumns[':p' . $index++] = '`CHAPO`';
     }
     if ($this->isColumnModified(ModuleImageI18nTableMap::POSTSCRIPTUM)) {
         $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
     }
     $sql = sprintf('INSERT INTO `module_image_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`LOCALE`':
                     $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
                     break;
                 case '`TITLE`':
                     $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
                     break;
                 case '`DESCRIPTION`':
                     $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
                     break;
                 case '`CHAPO`':
                     $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
                     break;
                 case '`POSTSCRIPTUM`':
                     $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     $this->setNew(false);
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildInseeGeoDepartment A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT ID, MAIN_MUNICIPALITY_ID, REGION_ID, GEO_POINT2D_X, GEO_POINT2D_Y, GEO_SHAPE, CREATED_AT, UPDATED_AT FROM insee_geo_department WHERE ID = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildInseeGeoDepartment();
         $obj->hydrate($row);
         InseeGeoDepartmentTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #10
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[GroupTableMap::COL_ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . GroupTableMap::COL_ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(GroupTableMap::COL_ID)) {
         $modifiedColumns[':p' . $index++] = 'id';
     }
     if ($this->isColumnModified(GroupTableMap::COL_NAME)) {
         $modifiedColumns[':p' . $index++] = 'name';
     }
     if ($this->isColumnModified(GroupTableMap::COL_DESCRIPTION)) {
         $modifiedColumns[':p' . $index++] = 'description';
     }
     if ($this->isColumnModified(GroupTableMap::COL_OWNER_ID)) {
         $modifiedColumns[':p' . $index++] = 'owner_id';
     }
     if ($this->isColumnModified(GroupTableMap::COL_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'created_at';
     }
     if ($this->isColumnModified(GroupTableMap::COL_UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'updated_at';
     }
     $sql = sprintf('INSERT INTO group_of_users (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'id':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case 'name':
                     $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
                     break;
                 case 'description':
                     $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
                     break;
                 case 'owner_id':
                     $stmt->bindValue($identifier, $this->owner_id, PDO::PARAM_INT);
                     break;
                 case 'created_at':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'updated_at':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
Example #11
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[UserTableMap::COL_ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserTableMap::COL_ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(UserTableMap::COL_ID)) {
         $modifiedColumns[':p' . $index++] = 'ID';
     }
     if ($this->isColumnModified(UserTableMap::COL_USERNAME)) {
         $modifiedColumns[':p' . $index++] = 'USERNAME';
     }
     if ($this->isColumnModified(UserTableMap::COL_PASSWORD)) {
         $modifiedColumns[':p' . $index++] = 'PASSWORD';
     }
     if ($this->isColumnModified(UserTableMap::COL_FIRST_NAME)) {
         $modifiedColumns[':p' . $index++] = 'FIRST_NAME';
     }
     if ($this->isColumnModified(UserTableMap::COL_LAST_NAME)) {
         $modifiedColumns[':p' . $index++] = 'LAST_NAME';
     }
     if ($this->isColumnModified(UserTableMap::COL_CREATE_DATE)) {
         $modifiedColumns[':p' . $index++] = 'CREATE_DATE';
     }
     if ($this->isColumnModified(UserTableMap::COL_UPDATE_DATE)) {
         $modifiedColumns[':p' . $index++] = 'UPDATE_DATE';
     }
     if ($this->isColumnModified(UserTableMap::COL_STATUS)) {
         $modifiedColumns[':p' . $index++] = 'STATUS';
     }
     $sql = sprintf('INSERT INTO user (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'ID':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case 'USERNAME':
                     $stmt->bindValue($identifier, $this->username, PDO::PARAM_STR);
                     break;
                 case 'PASSWORD':
                     $stmt->bindValue($identifier, $this->password, PDO::PARAM_STR);
                     break;
                 case 'FIRST_NAME':
                     $stmt->bindValue($identifier, $this->first_name, PDO::PARAM_STR);
                     break;
                 case 'LAST_NAME':
                     $stmt->bindValue($identifier, $this->last_name, PDO::PARAM_STR);
                     break;
                 case 'CREATE_DATE':
                     $stmt->bindValue($identifier, $this->create_date ? $this->create_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'UPDATE_DATE':
                     $stmt->bindValue($identifier, $this->update_date ? $this->update_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'STATUS':
                     $stmt->bindValue($identifier, $this->status, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
Example #12
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return ChildDebit A model object, or null if the key is not found
  */
 protected function findPkSimple($key, ConnectionInterface $con)
 {
     $sql = 'SELECT ID, PURCHASE_ID, TOTAL, PAID, STATUS FROM debit WHERE ID = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         /** @var ChildDebit $obj */
         $obj = new ChildDebit();
         $obj->hydrate($row);
         DebitTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #13
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildPlayersOld A model object, or null if the key is not found
  */
 protected function findPkSimple($key, ConnectionInterface $con)
 {
     $sql = 'SELECT ID, lastn, bats, bday, age, mlb, draft_year, position, card, d_e, lg, mwbl, category, comment, mwbl_link, mlb_link, mwbl_link_enabled, mlb_link_enabled FROM players_old WHERE ID = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         /** @var ChildPlayersOld $obj */
         $obj = new ChildPlayersOld();
         $obj->hydrate($row);
         PlayersOldTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #14
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildAccessory A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `ID`, `PRODUCT_ID`, `ACCESSORY`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `accessory` WHERE `ID` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildAccessory();
         $obj->hydrate($row);
         AccessoryTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildPermissionGroupUser A model object, or null if the key is not found
  */
 protected function findPkSimple($key, ConnectionInterface $con)
 {
     $sql = 'SELECT `user_id`, `group_id` FROM `permission_group_user` WHERE `user_id` = :p0 AND `group_id` = :p1';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
         $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         /** @var ChildPermissionGroupUser $obj */
         $obj = new ChildPermissionGroupUser();
         $obj->hydrate($row);
         PermissionGroupUserTableMap::addInstanceToPool($obj, serialize([null === $key[0] || is_scalar($key[0]) || is_callable([$key[0], '__toString']) ? (string) $key[0] : $key[0], null === $key[1] || is_scalar($key[1]) || is_callable([$key[1], '__toString']) ? (string) $key[1] : $key[1]]));
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #16
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildProductVersion A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VIRTUAL`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `BRAND_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
         $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildProductVersion();
         $obj->hydrate($row);
         ProductVersionTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
     }
     $stmt->closeCursor();
     return $obj;
 }
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(MenuI18nVersionTableMap::ID)) {
         $modifiedColumns[':p' . $index++] = 'ID';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::LOCALE)) {
         $modifiedColumns[':p' . $index++] = 'LOCALE';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::TITLE)) {
         $modifiedColumns[':p' . $index++] = 'TITLE';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::DESCRIPTION)) {
         $modifiedColumns[':p' . $index++] = 'DESCRIPTION';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::CHAPO)) {
         $modifiedColumns[':p' . $index++] = 'CHAPO';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::POSTSCRIPTUM)) {
         $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'CREATED_AT';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::VERSION)) {
         $modifiedColumns[':p' . $index++] = 'VERSION';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::VERSION_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT';
     }
     if ($this->isColumnModified(MenuI18nVersionTableMap::VERSION_CREATED_BY)) {
         $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY';
     }
     $sql = sprintf('INSERT INTO menu_i18n_version (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'ID':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case 'LOCALE':
                     $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
                     break;
                 case 'TITLE':
                     $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
                     break;
                 case 'DESCRIPTION':
                     $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
                     break;
                 case 'CHAPO':
                     $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
                     break;
                 case 'POSTSCRIPTUM':
                     $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
                     break;
                 case 'CREATED_AT':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'UPDATED_AT':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'VERSION':
                     $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
                     break;
                 case 'VERSION_CREATED_AT':
                     $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'VERSION_CREATED_BY':
                     $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     $this->setNew(false);
 }
Example #18
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[StudentTableMap::COL_ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . StudentTableMap::COL_ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(StudentTableMap::COL_ID)) {
         $modifiedColumns[':p' . $index++] = 'id';
     }
     if ($this->isColumnModified(StudentTableMap::COL_IDENTIFICATION_NUMBER)) {
         $modifiedColumns[':p' . $index++] = 'identification_number';
     }
     if ($this->isColumnModified(StudentTableMap::COL_SCHOOL_YEAR_ID)) {
         $modifiedColumns[':p' . $index++] = 'school_year_id';
     }
     if ($this->isColumnModified(StudentTableMap::COL_COURSE_ID)) {
         $modifiedColumns[':p' . $index++] = 'course_id';
     }
     if ($this->isColumnModified(StudentTableMap::COL_FIRST_NAME)) {
         $modifiedColumns[':p' . $index++] = 'first_name';
     }
     if ($this->isColumnModified(StudentTableMap::COL_LAST_NAME)) {
         $modifiedColumns[':p' . $index++] = 'last_name';
     }
     if ($this->isColumnModified(StudentTableMap::COL_BIRTH_PLACE)) {
         $modifiedColumns[':p' . $index++] = 'birth_place';
     }
     if ($this->isColumnModified(StudentTableMap::COL_BIRTHDAY)) {
         $modifiedColumns[':p' . $index++] = 'birthday';
     }
     if ($this->isColumnModified(StudentTableMap::COL_PHONE_NUMBER)) {
         $modifiedColumns[':p' . $index++] = 'phone_number';
     }
     if ($this->isColumnModified(StudentTableMap::COL_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'created_at';
     }
     if ($this->isColumnModified(StudentTableMap::COL_UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = 'updated_at';
     }
     $sql = sprintf('INSERT INTO student (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'id':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case 'identification_number':
                     $stmt->bindValue($identifier, $this->identification_number, PDO::PARAM_INT);
                     break;
                 case 'school_year_id':
                     $stmt->bindValue($identifier, $this->school_year_id, PDO::PARAM_INT);
                     break;
                 case 'course_id':
                     $stmt->bindValue($identifier, $this->course_id, PDO::PARAM_INT);
                     break;
                 case 'first_name':
                     $stmt->bindValue($identifier, $this->first_name, PDO::PARAM_STR);
                     break;
                 case 'last_name':
                     $stmt->bindValue($identifier, $this->last_name, PDO::PARAM_STR);
                     break;
                 case 'birth_place':
                     $stmt->bindValue($identifier, $this->birth_place, PDO::PARAM_STR);
                     break;
                 case 'birthday':
                     $stmt->bindValue($identifier, $this->birthday ? $this->birthday->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'phone_number':
                     $stmt->bindValue($identifier, $this->phone_number, PDO::PARAM_STR);
                     break;
                 case 'created_at':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case 'updated_at':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
Example #19
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(CustomerTitleI18nTableMap::ID)) {
         $modifiedColumns[':p' . $index++] = '`ID`';
     }
     if ($this->isColumnModified(CustomerTitleI18nTableMap::LOCALE)) {
         $modifiedColumns[':p' . $index++] = '`LOCALE`';
     }
     if ($this->isColumnModified(CustomerTitleI18nTableMap::SHORT)) {
         $modifiedColumns[':p' . $index++] = '`SHORT`';
     }
     if ($this->isColumnModified(CustomerTitleI18nTableMap::LONG)) {
         $modifiedColumns[':p' . $index++] = '`LONG`';
     }
     $sql = sprintf('INSERT INTO `customer_title_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`LOCALE`':
                     $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
                     break;
                 case '`SHORT`':
                     $stmt->bindValue($identifier, $this->short, PDO::PARAM_STR);
                     break;
                 case '`LONG`':
                     $stmt->bindValue($identifier, $this->long, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     $this->setNew(false);
 }
Example #20
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(SessionTableMap::COL_TOKEN)) {
         $modifiedColumns[':p' . $index++] = '`token`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_USER_ID)) {
         $modifiedColumns[':p' . $index++] = '`user_id`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_IP)) {
         $modifiedColumns[':p' . $index++] = '`ip`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_USER_AGENT)) {
         $modifiedColumns[':p' . $index++] = '`user_agent`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_BROWSER)) {
         $modifiedColumns[':p' . $index++] = '`browser`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_DEVICE)) {
         $modifiedColumns[':p' . $index++] = '`device`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_OS)) {
         $modifiedColumns[':p' . $index++] = '`os`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_LOCATION)) {
         $modifiedColumns[':p' . $index++] = '`location`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`created_at`';
     }
     if ($this->isColumnModified(SessionTableMap::COL_UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`updated_at`';
     }
     $sql = sprintf('INSERT INTO `kk_session` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`token`':
                     $stmt->bindValue($identifier, $this->token, PDO::PARAM_STR);
                     break;
                 case '`user_id`':
                     $stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT);
                     break;
                 case '`ip`':
                     $stmt->bindValue($identifier, $this->ip, PDO::PARAM_STR);
                     break;
                 case '`user_agent`':
                     $stmt->bindValue($identifier, $this->user_agent, PDO::PARAM_STR);
                     break;
                 case '`browser`':
                     $stmt->bindValue($identifier, $this->browser, PDO::PARAM_STR);
                     break;
                 case '`device`':
                     $stmt->bindValue($identifier, $this->device, PDO::PARAM_STR);
                     break;
                 case '`os`':
                     $stmt->bindValue($identifier, $this->os, PDO::PARAM_STR);
                     break;
                 case '`location`':
                     $stmt->bindValue($identifier, $this->location, PDO::PARAM_STR);
                     break;
                 case '`created_at`':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`updated_at`':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     $this->setNew(false);
 }
Example #21
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildCustomerTitleI18n A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `ID`, `LOCALE`, `SHORT`, `LONG` FROM `customer_title_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
         $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildCustomerTitleI18n();
         $obj->hydrate($row);
         CustomerTitleI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #22
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildJudge A model object, or null if the key is not found
  */
 protected function findPkSimple($key, ConnectionInterface $con)
 {
     $sql = 'SELECT `id`, `position`, `startgroup_id`, `user_id` FROM `kk_junia_judge` WHERE `id` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         /** @var ChildJudge $obj */
         $obj = new ChildJudge();
         $obj->hydrate($row);
         JudgeTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #23
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[JaCategoriasTableMap::COL_ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . JaCategoriasTableMap::COL_ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(JaCategoriasTableMap::COL_ID)) {
         $modifiedColumns[':p' . $index++] = 'id';
     }
     if ($this->isColumnModified(JaCategoriasTableMap::COL_TITULO)) {
         $modifiedColumns[':p' . $index++] = 'titulo';
     }
     if ($this->isColumnModified(JaCategoriasTableMap::COL_SLUG)) {
         $modifiedColumns[':p' . $index++] = 'slug';
     }
     $sql = sprintf('INSERT INTO ja_categorias (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'id':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case 'titulo':
                     $stmt->bindValue($identifier, $this->titulo, PDO::PARAM_STR);
                     break;
                 case 'slug':
                     $stmt->bindValue($identifier, $this->slug, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
Example #24
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[DataTableMap::COL_ID] = true;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . DataTableMap::COL_ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(DataTableMap::COL_ID)) {
         $modifiedColumns[':p' . $index++] = 'id';
     }
     if ($this->isColumnModified(DataTableMap::COL__FORCONTRIBUTION)) {
         $modifiedColumns[':p' . $index++] = '_forcontribution';
     }
     if ($this->isColumnModified(DataTableMap::COL__FORTEMPLATEFIELD)) {
         $modifiedColumns[':p' . $index++] = '_fortemplatefield';
     }
     if ($this->isColumnModified(DataTableMap::COL__CONTENT)) {
         $modifiedColumns[':p' . $index++] = '_content';
     }
     if ($this->isColumnModified(DataTableMap::COL__ISJSON)) {
         $modifiedColumns[':p' . $index++] = '_isjson';
     }
     if ($this->isColumnModified(DataTableMap::COL___USER__)) {
         $modifiedColumns[':p' . $index++] = '__user__';
     }
     if ($this->isColumnModified(DataTableMap::COL___CONFIG__)) {
         $modifiedColumns[':p' . $index++] = '__config__';
     }
     if ($this->isColumnModified(DataTableMap::COL___SPLIT__)) {
         $modifiedColumns[':p' . $index++] = '__split__';
     }
     if ($this->isColumnModified(DataTableMap::COL___PARENTNODE__)) {
         $modifiedColumns[':p' . $index++] = '__parentnode__';
     }
     if ($this->isColumnModified(DataTableMap::COL___SORT__)) {
         $modifiedColumns[':p' . $index++] = '__sort__';
     }
     $sql = sprintf('INSERT INTO _data (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case 'id':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '_forcontribution':
                     $stmt->bindValue($identifier, $this->_forcontribution, PDO::PARAM_INT);
                     break;
                 case '_fortemplatefield':
                     $stmt->bindValue($identifier, $this->_fortemplatefield, PDO::PARAM_INT);
                     break;
                 case '_content':
                     $stmt->bindValue($identifier, $this->_content, PDO::PARAM_STR);
                     break;
                 case '_isjson':
                     $stmt->bindValue($identifier, (int) $this->_isjson, PDO::PARAM_INT);
                     break;
                 case '__user__':
                     $stmt->bindValue($identifier, $this->__user__, PDO::PARAM_INT);
                     break;
                 case '__config__':
                     $stmt->bindValue($identifier, $this->__config__, PDO::PARAM_STR);
                     break;
                 case '__split__':
                     $stmt->bindValue($identifier, $this->__split__, PDO::PARAM_STR);
                     break;
                 case '__parentnode__':
                     $stmt->bindValue($identifier, $this->__parentnode__, PDO::PARAM_INT);
                     break;
                 case '__sort__':
                     $stmt->bindValue($identifier, $this->__sort__, PDO::PARAM_INT);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', 0, $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildTranslationCatalog A model object, or null if the key is not found
  */
 protected function findPkSimple($key, ConnectionInterface $con)
 {
     $sql = 'SELECT id, application_id, name, created_at, updated_at FROM translation_catalog WHERE id = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         /** @var ChildTranslationCatalog $obj */
         $obj = new ChildTranslationCatalog();
         $obj->hydrate($row);
         TranslationCatalogTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildDiaporamaVersion A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT ID, SHORTCODE, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM diaporama_version WHERE ID = :p0 AND VERSION = :p1';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
         $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildDiaporamaVersion();
         $obj->hydrate($row);
         DiaporamaVersionTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #27
0
 /**
  * Insert the row in the database.
  *
  * @param      ConnectionInterface $con
  *
  * @throws PropelException
  * @see doSave()
  */
 protected function doInsert(ConnectionInterface $con)
 {
     $modifiedColumns = array();
     $index = 0;
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(CouponVersionTableMap::ID)) {
         $modifiedColumns[':p' . $index++] = '`ID`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::CODE)) {
         $modifiedColumns[':p' . $index++] = '`CODE`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::TYPE)) {
         $modifiedColumns[':p' . $index++] = '`TYPE`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_EFFECTS)) {
         $modifiedColumns[':p' . $index++] = '`SERIALIZED_EFFECTS`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) {
         $modifiedColumns[':p' . $index++] = '`IS_ENABLED`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::START_DATE)) {
         $modifiedColumns[':p' . $index++] = '`START_DATE`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::EXPIRATION_DATE)) {
         $modifiedColumns[':p' . $index++] = '`EXPIRATION_DATE`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::MAX_USAGE)) {
         $modifiedColumns[':p' . $index++] = '`MAX_USAGE`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::IS_CUMULATIVE)) {
         $modifiedColumns[':p' . $index++] = '`IS_CUMULATIVE`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::IS_REMOVING_POSTAGE)) {
         $modifiedColumns[':p' . $index++] = '`IS_REMOVING_POSTAGE`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) {
         $modifiedColumns[':p' . $index++] = '`IS_AVAILABLE_ON_SPECIAL_OFFERS`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) {
         $modifiedColumns[':p' . $index++] = '`IS_USED`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_CONDITIONS)) {
         $modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT)) {
         $modifiedColumns[':p' . $index++] = '`PER_CUSTOMER_USAGE_COUNT`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::VERSION)) {
         $modifiedColumns[':p' . $index++] = '`VERSION`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
     }
     if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
     }
     $sql = sprintf('INSERT INTO `coupon_version` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`CODE`':
                     $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
                     break;
                 case '`TYPE`':
                     $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
                     break;
                 case '`SERIALIZED_EFFECTS`':
                     $stmt->bindValue($identifier, $this->serialized_effects, PDO::PARAM_STR);
                     break;
                 case '`IS_ENABLED`':
                     $stmt->bindValue($identifier, (int) $this->is_enabled, PDO::PARAM_INT);
                     break;
                 case '`START_DATE`':
                     $stmt->bindValue($identifier, $this->start_date ? $this->start_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`EXPIRATION_DATE`':
                     $stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`MAX_USAGE`':
                     $stmt->bindValue($identifier, $this->max_usage, PDO::PARAM_INT);
                     break;
                 case '`IS_CUMULATIVE`':
                     $stmt->bindValue($identifier, (int) $this->is_cumulative, PDO::PARAM_INT);
                     break;
                 case '`IS_REMOVING_POSTAGE`':
                     $stmt->bindValue($identifier, (int) $this->is_removing_postage, PDO::PARAM_INT);
                     break;
                 case '`IS_AVAILABLE_ON_SPECIAL_OFFERS`':
                     $stmt->bindValue($identifier, (int) $this->is_available_on_special_offers, PDO::PARAM_INT);
                     break;
                 case '`IS_USED`':
                     $stmt->bindValue($identifier, (int) $this->is_used, PDO::PARAM_INT);
                     break;
                 case '`SERIALIZED_CONDITIONS`':
                     $stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR);
                     break;
                 case '`PER_CUSTOMER_USAGE_COUNT`':
                     $stmt->bindValue($identifier, (int) $this->per_customer_usage_count, PDO::PARAM_INT);
                     break;
                 case '`CREATED_AT`':
                     $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`UPDATED_AT`':
                     $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`VERSION`':
                     $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
                     break;
                 case '`VERSION_CREATED_AT`':
                     $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
                     break;
                 case '`VERSION_CREATED_BY`':
                     $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
     }
     $this->setNew(false);
 }
Example #28
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildCouponCountry A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `COUPON_ID`, `COUNTRY_ID` FROM `coupon_country` WHERE `COUPON_ID` = :p0 AND `COUNTRY_ID` = :p1';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
         $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildCouponCountry();
         $obj->hydrate($row);
         CouponCountryTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
     }
     $stmt->closeCursor();
     return $obj;
 }
Example #29
0
 /**
  * Init some properties with the help of outer class
  * @param      Criteria $criteria The outer class
  */
 public function init(Criteria $criteria)
 {
     // init $this->db
     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;
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     ConnectionInterface $con A connection object
  *
  * @return   ChildOrderCoupon A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `TYPE`, `AMOUNT`, `TITLE`, `SHORT_DESCRIPTION`, `DESCRIPTION`, `START_DATE`, `EXPIRATION_DATE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `USAGE_CANCELED`, `CREATED_AT`, `UPDATED_AT` FROM `order_coupon` WHERE `ID` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
         $obj = new ChildOrderCoupon();
         $obj->hydrate($row);
         OrderCouponTableMap::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }