/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[LangTableMap::ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . LangTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(LangTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(LangTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(LangTableMap::CODE)) { $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(LangTableMap::LOCALE)) { $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(LangTableMap::URL)) { $modifiedColumns[':p' . $index++] = '`URL`'; } if ($this->isColumnModified(LangTableMap::DATE_FORMAT)) { $modifiedColumns[':p' . $index++] = '`DATE_FORMAT`'; } if ($this->isColumnModified(LangTableMap::TIME_FORMAT)) { $modifiedColumns[':p' . $index++] = '`TIME_FORMAT`'; } if ($this->isColumnModified(LangTableMap::DATETIME_FORMAT)) { $modifiedColumns[':p' . $index++] = '`DATETIME_FORMAT`'; } if ($this->isColumnModified(LangTableMap::DECIMAL_SEPARATOR)) { $modifiedColumns[':p' . $index++] = '`DECIMAL_SEPARATOR`'; } if ($this->isColumnModified(LangTableMap::THOUSANDS_SEPARATOR)) { $modifiedColumns[':p' . $index++] = '`THOUSANDS_SEPARATOR`'; } if ($this->isColumnModified(LangTableMap::DECIMALS)) { $modifiedColumns[':p' . $index++] = '`DECIMALS`'; } if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) { $modifiedColumns[':p' . $index++] = '`BY_DEFAULT`'; } if ($this->isColumnModified(LangTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(LangTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(LangTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf('INSERT INTO `lang` (%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 '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; case '`URL`': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; case '`DATE_FORMAT`': $stmt->bindValue($identifier, $this->date_format, PDO::PARAM_STR); break; case '`TIME_FORMAT`': $stmt->bindValue($identifier, $this->time_format, PDO::PARAM_STR); break; case '`DATETIME_FORMAT`': $stmt->bindValue($identifier, $this->datetime_format, PDO::PARAM_STR); break; case '`DECIMAL_SEPARATOR`': $stmt->bindValue($identifier, $this->decimal_separator, PDO::PARAM_STR); break; case '`THOUSANDS_SEPARATOR`': $stmt->bindValue($identifier, $this->thousands_separator, PDO::PARAM_STR); break; case '`DECIMALS`': $stmt->bindValue($identifier, $this->decimals, PDO::PARAM_STR); break; case '`BY_DEFAULT`': $stmt->bindValue($identifier, $this->by_default, 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; } } $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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[WpUsermetaTableMap::COL_UMETA_ID] = true; if (null !== $this->umeta_id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . WpUsermetaTableMap::COL_UMETA_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(WpUsermetaTableMap::COL_UMETA_ID)) { $modifiedColumns[':p' . $index++] = 'umeta_id'; } if ($this->isColumnModified(WpUsermetaTableMap::COL_USER_ID)) { $modifiedColumns[':p' . $index++] = 'user_id'; } if ($this->isColumnModified(WpUsermetaTableMap::COL_META_KEY)) { $modifiedColumns[':p' . $index++] = 'meta_key'; } if ($this->isColumnModified(WpUsermetaTableMap::COL_META_VALUE)) { $modifiedColumns[':p' . $index++] = 'meta_value'; } $sql = sprintf('INSERT INTO wp_usermeta (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns))); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case 'umeta_id': $stmt->bindValue($identifier, $this->umeta_id, PDO::PARAM_INT); break; case 'user_id': $stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT); break; case 'meta_key': $stmt->bindValue($identifier, $this->meta_key, PDO::PARAM_STR); break; case 'meta_value': $stmt->bindValue($identifier, $this->meta_value, 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->setUmetaId($pk); $this->setNew(false); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[MatchTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . MatchTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(MatchTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(MatchTableMap::COL_NR)) { $modifiedColumns[':p' . $index++] = 'nr'; } if ($this->isColumnModified(MatchTableMap::COL_DATE)) { $modifiedColumns[':p' . $index++] = 'date'; } if ($this->isColumnModified(MatchTableMap::COL_RESULT)) { $modifiedColumns[':p' . $index++] = 'result'; } if ($this->isColumnModified(MatchTableMap::COL_TOTO)) { $modifiedColumns[':p' . $index++] = 'toto'; } if ($this->isColumnModified(MatchTableMap::COL_CHAMPIONSHIP_ID)) { $modifiedColumns[':p' . $index++] = 'championship_id'; } if ($this->isColumnModified(MatchTableMap::COL_ROUND_ID)) { $modifiedColumns[':p' . $index++] = 'round_id'; } if ($this->isColumnModified(MatchTableMap::COL_LEAGUE_ID)) { $modifiedColumns[':p' . $index++] = 'league_id'; } if ($this->isColumnModified(MatchTableMap::COL_HOMETEAM_ID)) { $modifiedColumns[':p' . $index++] = 'hometeam_id'; } if ($this->isColumnModified(MatchTableMap::COL_AWAYTEAM_ID)) { $modifiedColumns[':p' . $index++] = 'awayteam_id'; } $sql = sprintf('INSERT INTO matches (%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 'nr': $stmt->bindValue($identifier, $this->nr, PDO::PARAM_INT); break; case 'date': $stmt->bindValue($identifier, $this->date ? $this->date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case 'result': $stmt->bindValue($identifier, $this->result, PDO::PARAM_STR); break; case 'toto': $stmt->bindValue($identifier, $this->toto, PDO::PARAM_INT); break; case 'championship_id': $stmt->bindValue($identifier, $this->championship_id, PDO::PARAM_INT); break; case 'round_id': $stmt->bindValue($identifier, $this->round_id, PDO::PARAM_INT); break; case 'league_id': $stmt->bindValue($identifier, $this->league_id, PDO::PARAM_INT); break; case 'hometeam_id': $stmt->bindValue($identifier, $this->hometeam_id, PDO::PARAM_INT); break; case 'awayteam_id': $stmt->bindValue($identifier, $this->awayteam_id, 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[InvTypesTableMap::COL_TYPEID] = true; if (null !== $this->typeid) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . InvTypesTableMap::COL_TYPEID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(InvTypesTableMap::COL_TYPEID)) { $modifiedColumns[':p' . $index++] = 'typeID'; } if ($this->isColumnModified(InvTypesTableMap::COL_GROUPID)) { $modifiedColumns[':p' . $index++] = 'groupID'; } if ($this->isColumnModified(InvTypesTableMap::COL_TYPENAME)) { $modifiedColumns[':p' . $index++] = 'typeName'; } if ($this->isColumnModified(InvTypesTableMap::COL_VOLUME)) { $modifiedColumns[':p' . $index++] = 'volume'; } if ($this->isColumnModified(InvTypesTableMap::COL_CAPACITY)) { $modifiedColumns[':p' . $index++] = 'capacity'; } if ($this->isColumnModified(InvTypesTableMap::COL_PUBLISHED)) { $modifiedColumns[':p' . $index++] = 'published'; } $sql = sprintf('INSERT INTO invtypes (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns))); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case 'typeID': $stmt->bindValue($identifier, $this->typeid, PDO::PARAM_INT); break; case 'groupID': $stmt->bindValue($identifier, $this->groupid, PDO::PARAM_INT); break; case 'typeName': $stmt->bindValue($identifier, $this->typename, PDO::PARAM_STR); break; case 'volume': $stmt->bindValue($identifier, $this->volume, PDO::PARAM_STR); break; case 'capacity': $stmt->bindValue($identifier, $this->capacity, PDO::PARAM_STR); break; case 'published': $stmt->bindValue($identifier, $this->published, 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->setTypeid($pk); $this->setNew(false); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[NoteTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . NoteTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(NoteTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(NoteTableMap::COL_USER_ID)) { $modifiedColumns[':p' . $index++] = 'user_id'; } if ($this->isColumnModified(NoteTableMap::COL_IMPORTANCE)) { $modifiedColumns[':p' . $index++] = 'importance'; } if ($this->isColumnModified(NoteTableMap::COL_TITLE)) { $modifiedColumns[':p' . $index++] = 'title'; } if ($this->isColumnModified(NoteTableMap::COL_DEADLINE)) { $modifiedColumns[':p' . $index++] = 'deadline'; } if ($this->isColumnModified(NoteTableMap::COL_CATEGORY_ID)) { $modifiedColumns[':p' . $index++] = 'category_id'; } if ($this->isColumnModified(NoteTableMap::COL_STATE)) { $modifiedColumns[':p' . $index++] = 'state'; } if ($this->isColumnModified(NoteTableMap::COL_REPEAT_AFTER)) { $modifiedColumns[':p' . $index++] = 'repeat_after'; } if ($this->isColumnModified(NoteTableMap::COL_DONE_AT)) { $modifiedColumns[':p' . $index++] = 'done_at'; } if ($this->isColumnModified(NoteTableMap::COL_PUBLIC)) { $modifiedColumns[':p' . $index++] = 'public'; } if ($this->isColumnModified(NoteTableMap::COL_DESCRIPTION)) { $modifiedColumns[':p' . $index++] = 'description'; } if ($this->isColumnModified(NoteTableMap::COL_CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'created_at'; } if ($this->isColumnModified(NoteTableMap::COL_UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'updated_at'; } $sql = sprintf('INSERT INTO note (%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 'user_id': $stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT); break; case 'importance': $stmt->bindValue($identifier, $this->importance, PDO::PARAM_INT); break; case 'title': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; case 'deadline': $stmt->bindValue($identifier, $this->deadline ? $this->deadline->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case 'category_id': $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); break; case 'state': $stmt->bindValue($identifier, $this->state, PDO::PARAM_INT); break; case 'repeat_after': $stmt->bindValue($identifier, $this->repeat_after, PDO::PARAM_INT); break; case 'done_at': $stmt->bindValue($identifier, $this->done_at ? $this->done_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case 'public': $stmt->bindValue($identifier, (int) $this->public, PDO::PARAM_INT); break; case 'description': $stmt->bindValue($identifier, $this->description, 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[] = ActorTableMap::ID; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . ActorTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ActorTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } if ($this->isColumnModified(ActorTableMap::MOVIE_ID)) { $modifiedColumns[':p' . $index++] = 'MOVIE_ID'; } if ($this->isColumnModified(ActorTableMap::NAME)) { $modifiedColumns[':p' . $index++] = 'NAME'; } if ($this->isColumnModified(ActorTableMap::SURNAME)) { $modifiedColumns[':p' . $index++] = 'SURNAME'; } $sql = sprintf('INSERT INTO actor (%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 'MOVIE_ID': $stmt->bindValue($identifier, $this->movie_id, PDO::PARAM_INT); break; case 'NAME': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case 'SURNAME': $stmt->bindValue($identifier, $this->surname, 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); }
/** * Gets the generated ID (either last ID for autoincrement or next sequence ID). * * @param ConnectionInterface $con * @param string $name * * @return mixed */ public function getId(ConnectionInterface $con, $name = null) { return $con->lastInsertId($name); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[ДатыОбновленийДашбордовTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . ДатыОбновленийДашбордовTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ДатыОбновленийДашбордовTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(ДатыОбновленийДашбордовTableMap::COL_ДашбнрХ)) { $modifiedColumns[':p' . $index++] = 'Дашборд'; } if ($this->isColumnModified(ДатыОбновленийДашбордовTableMap::COL_ЏрнеЪт)) { $modifiedColumns[':p' . $index++] = 'Проект'; } if ($this->isColumnModified(ДатыОбновленийДашбордовTableMap::COL_Дата)) { $modifiedColumns[':p' . $index++] = 'Дата'; } $sql = sprintf('INSERT INTO Даты_обновлений_дашбордов (%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 'Дашборд': $stmt->bindValue($identifier, $this->�������, PDO::PARAM_STR); break; case 'Проект': $stmt->bindValue($identifier, $this->������, PDO::PARAM_INT); break; case 'Дата': $stmt->bindValue($identifier, $this->���� ? $this->����->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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[InputErrorTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . InputErrorTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(InputErrorTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(InputErrorTableMap::COL_INPUT_UUID)) { $modifiedColumns[':p' . $index++] = 'input_uuid'; } if ($this->isColumnModified(InputErrorTableMap::COL_BER_AVERAGE)) { $modifiedColumns[':p' . $index++] = 'ber_average'; } if ($this->isColumnModified(InputErrorTableMap::COL_UNC_AVERAGE)) { $modifiedColumns[':p' . $index++] = 'unc_average'; } if ($this->isColumnModified(InputErrorTableMap::COL_CUMULATIVE_TE)) { $modifiedColumns[':p' . $index++] = 'cumulative_te'; } if ($this->isColumnModified(InputErrorTableMap::COL_CUMULATIVE_CC)) { $modifiedColumns[':p' . $index++] = 'cumulative_cc'; } if ($this->isColumnModified(InputErrorTableMap::COL_CREATED)) { $modifiedColumns[':p' . $index++] = 'created'; } if ($this->isColumnModified(InputErrorTableMap::COL_MODIFIED)) { $modifiedColumns[':p' . $index++] = 'modified'; } $sql = sprintf('INSERT INTO input_error (%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 'input_uuid': $stmt->bindValue($identifier, $this->input_uuid, PDO::PARAM_STR); break; case 'ber_average': $stmt->bindValue($identifier, $this->ber_average, PDO::PARAM_STR); break; case 'unc_average': $stmt->bindValue($identifier, $this->unc_average, PDO::PARAM_STR); break; case 'cumulative_te': $stmt->bindValue($identifier, $this->cumulative_te, PDO::PARAM_INT); break; case 'cumulative_cc': $stmt->bindValue($identifier, $this->cumulative_cc, PDO::PARAM_INT); break; case 'created': $stmt->bindValue($identifier, $this->created ? $this->created->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case 'modified': $stmt->bindValue($identifier, $this->modified ? $this->modified->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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[RatingCategoriesTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . RatingCategoriesTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(RatingCategoriesTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } if ($this->isColumnModified(RatingCategoriesTableMap::COL_TITLE)) { $modifiedColumns[':p' . $index++] = 'title'; } if ($this->isColumnModified(RatingCategoriesTableMap::COL_DESCRIPTION)) { $modifiedColumns[':p' . $index++] = 'description'; } if ($this->isColumnModified(RatingCategoriesTableMap::COL_WEIGHT)) { $modifiedColumns[':p' . $index++] = 'weight'; } if ($this->isColumnModified(RatingCategoriesTableMap::COL_SEQUENCE)) { $modifiedColumns[':p' . $index++] = 'sequence'; } $sql = sprintf('INSERT INTO rating_categories (%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 'title': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; case 'description': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; case 'weight': $stmt->bindValue($identifier, $this->weight, PDO::PARAM_INT); break; case 'sequence': $stmt->bindValue($identifier, $this->sequence, 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[OrderTableMap::ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderTableMap::REF)) { $modifiedColumns[':p' . $index++] = '`REF`'; } if ($this->isColumnModified(OrderTableMap::CUSTOMER_ID)) { $modifiedColumns[':p' . $index++] = '`CUSTOMER_ID`'; } if ($this->isColumnModified(OrderTableMap::INVOICE_ORDER_ADDRESS_ID)) { $modifiedColumns[':p' . $index++] = '`INVOICE_ORDER_ADDRESS_ID`'; } if ($this->isColumnModified(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID)) { $modifiedColumns[':p' . $index++] = '`DELIVERY_ORDER_ADDRESS_ID`'; } if ($this->isColumnModified(OrderTableMap::INVOICE_DATE)) { $modifiedColumns[':p' . $index++] = '`INVOICE_DATE`'; } if ($this->isColumnModified(OrderTableMap::CURRENCY_ID)) { $modifiedColumns[':p' . $index++] = '`CURRENCY_ID`'; } if ($this->isColumnModified(OrderTableMap::CURRENCY_RATE)) { $modifiedColumns[':p' . $index++] = '`CURRENCY_RATE`'; } if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) { $modifiedColumns[':p' . $index++] = '`TRANSACTION_REF`'; } if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) { $modifiedColumns[':p' . $index++] = '`DELIVERY_REF`'; } if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) { $modifiedColumns[':p' . $index++] = '`INVOICE_REF`'; } if ($this->isColumnModified(OrderTableMap::DISCOUNT)) { $modifiedColumns[':p' . $index++] = '`DISCOUNT`'; } if ($this->isColumnModified(OrderTableMap::POSTAGE)) { $modifiedColumns[':p' . $index++] = '`POSTAGE`'; } if ($this->isColumnModified(OrderTableMap::POSTAGE_TAX)) { $modifiedColumns[':p' . $index++] = '`POSTAGE_TAX`'; } if ($this->isColumnModified(OrderTableMap::POSTAGE_TAX_RULE_TITLE)) { $modifiedColumns[':p' . $index++] = '`POSTAGE_TAX_RULE_TITLE`'; } if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) { $modifiedColumns[':p' . $index++] = '`PAYMENT_MODULE_ID`'; } if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) { $modifiedColumns[':p' . $index++] = '`DELIVERY_MODULE_ID`'; } if ($this->isColumnModified(OrderTableMap::STATUS_ID)) { $modifiedColumns[':p' . $index++] = '`STATUS_ID`'; } if ($this->isColumnModified(OrderTableMap::LANG_ID)) { $modifiedColumns[':p' . $index++] = '`LANG_ID`'; } if ($this->isColumnModified(OrderTableMap::CART_ID)) { $modifiedColumns[':p' . $index++] = '`CART_ID`'; } if ($this->isColumnModified(OrderTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(OrderTableMap::VERSION)) { $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(OrderTableMap::VERSION_CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(OrderTableMap::VERSION_CREATED_BY)) { $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf('INSERT INTO `order` (%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 '`REF`': $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); break; case '`CUSTOMER_ID`': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); break; case '`INVOICE_ORDER_ADDRESS_ID`': $stmt->bindValue($identifier, $this->invoice_order_address_id, PDO::PARAM_INT); break; case '`DELIVERY_ORDER_ADDRESS_ID`': $stmt->bindValue($identifier, $this->delivery_order_address_id, PDO::PARAM_INT); break; case '`INVOICE_DATE`': $stmt->bindValue($identifier, $this->invoice_date ? $this->invoice_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case '`CURRENCY_ID`': $stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT); break; case '`CURRENCY_RATE`': $stmt->bindValue($identifier, $this->currency_rate, PDO::PARAM_STR); break; case '`TRANSACTION_REF`': $stmt->bindValue($identifier, $this->transaction_ref, PDO::PARAM_STR); break; case '`DELIVERY_REF`': $stmt->bindValue($identifier, $this->delivery_ref, PDO::PARAM_STR); break; case '`INVOICE_REF`': $stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR); break; case '`DISCOUNT`': $stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR); break; case '`POSTAGE`': $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR); break; case '`POSTAGE_TAX`': $stmt->bindValue($identifier, $this->postage_tax, PDO::PARAM_STR); break; case '`POSTAGE_TAX_RULE_TITLE`': $stmt->bindValue($identifier, $this->postage_tax_rule_title, PDO::PARAM_STR); break; case '`PAYMENT_MODULE_ID`': $stmt->bindValue($identifier, $this->payment_module_id, PDO::PARAM_INT); break; case '`DELIVERY_MODULE_ID`': $stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT); break; case '`STATUS_ID`': $stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT); break; case '`LANG_ID`': $stmt->bindValue($identifier, $this->lang_id, PDO::PARAM_INT); break; case '`CART_ID`': $stmt->bindValue($identifier, $this->cart_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; 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[ProductSaleElementsProductDocumentTableMap::ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProductSaleElementsProductDocumentTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductSaleElementsProductDocumentTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductSaleElementsProductDocumentTableMap::PRODUCT_SALE_ELEMENTS_ID)) { $modifiedColumns[':p' . $index++] = '`PRODUCT_SALE_ELEMENTS_ID`'; } if ($this->isColumnModified(ProductSaleElementsProductDocumentTableMap::PRODUCT_DOCUMENT_ID)) { $modifiedColumns[':p' . $index++] = '`PRODUCT_DOCUMENT_ID`'; } $sql = sprintf('INSERT INTO `product_sale_elements_product_document` (%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 '`PRODUCT_SALE_ELEMENTS_ID`': $stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT); break; case '`PRODUCT_DOCUMENT_ID`': $stmt->bindValue($identifier, $this->product_document_id, 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[OrderProductTableMap::ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderProductTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderProductTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderProductTableMap::ORDER_ID)) { $modifiedColumns[':p' . $index++] = '`ORDER_ID`'; } if ($this->isColumnModified(OrderProductTableMap::PRODUCT_REF)) { $modifiedColumns[':p' . $index++] = '`PRODUCT_REF`'; } if ($this->isColumnModified(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF)) { $modifiedColumns[':p' . $index++] = '`PRODUCT_SALE_ELEMENTS_REF`'; } if ($this->isColumnModified(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_ID)) { $modifiedColumns[':p' . $index++] = '`PRODUCT_SALE_ELEMENTS_ID`'; } if ($this->isColumnModified(OrderProductTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(OrderProductTableMap::CHAPO)) { $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(OrderProductTableMap::DESCRIPTION)) { $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(OrderProductTableMap::POSTSCRIPTUM)) { $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } if ($this->isColumnModified(OrderProductTableMap::QUANTITY)) { $modifiedColumns[':p' . $index++] = '`QUANTITY`'; } if ($this->isColumnModified(OrderProductTableMap::PRICE)) { $modifiedColumns[':p' . $index++] = '`PRICE`'; } if ($this->isColumnModified(OrderProductTableMap::PROMO_PRICE)) { $modifiedColumns[':p' . $index++] = '`PROMO_PRICE`'; } if ($this->isColumnModified(OrderProductTableMap::WAS_NEW)) { $modifiedColumns[':p' . $index++] = '`WAS_NEW`'; } if ($this->isColumnModified(OrderProductTableMap::WAS_IN_PROMO)) { $modifiedColumns[':p' . $index++] = '`WAS_IN_PROMO`'; } if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) { $modifiedColumns[':p' . $index++] = '`WEIGHT`'; } if ($this->isColumnModified(OrderProductTableMap::EAN_CODE)) { $modifiedColumns[':p' . $index++] = '`EAN_CODE`'; } if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) { $modifiedColumns[':p' . $index++] = '`TAX_RULE_TITLE`'; } if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_DESCRIPTION)) { $modifiedColumns[':p' . $index++] = '`TAX_RULE_DESCRIPTION`'; } if ($this->isColumnModified(OrderProductTableMap::PARENT)) { $modifiedColumns[':p' . $index++] = '`PARENT`'; } if ($this->isColumnModified(OrderProductTableMap::VIRTUAL)) { $modifiedColumns[':p' . $index++] = '`VIRTUAL`'; } if ($this->isColumnModified(OrderProductTableMap::VIRTUAL_DOCUMENT)) { $modifiedColumns[':p' . $index++] = '`VIRTUAL_DOCUMENT`'; } if ($this->isColumnModified(OrderProductTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderProductTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf('INSERT INTO `order_product` (%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 '`ORDER_ID`': $stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT); break; case '`PRODUCT_REF`': $stmt->bindValue($identifier, $this->product_ref, PDO::PARAM_STR); break; case '`PRODUCT_SALE_ELEMENTS_REF`': $stmt->bindValue($identifier, $this->product_sale_elements_ref, PDO::PARAM_STR); break; case '`PRODUCT_SALE_ELEMENTS_ID`': $stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT); break; case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; case '`QUANTITY`': $stmt->bindValue($identifier, $this->quantity, PDO::PARAM_STR); break; case '`PRICE`': $stmt->bindValue($identifier, $this->price, PDO::PARAM_STR); break; case '`PROMO_PRICE`': $stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR); break; case '`WAS_NEW`': $stmt->bindValue($identifier, $this->was_new, PDO::PARAM_INT); break; case '`WAS_IN_PROMO`': $stmt->bindValue($identifier, $this->was_in_promo, PDO::PARAM_INT); break; case '`WEIGHT`': $stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR); break; case '`EAN_CODE`': $stmt->bindValue($identifier, $this->ean_code, PDO::PARAM_STR); break; case '`TAX_RULE_TITLE`': $stmt->bindValue($identifier, $this->tax_rule_title, PDO::PARAM_STR); break; case '`TAX_RULE_DESCRIPTION`': $stmt->bindValue($identifier, $this->tax_rule_description, PDO::PARAM_STR); break; case '`PARENT`': $stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT); break; case '`VIRTUAL`': $stmt->bindValue($identifier, $this->virtual, PDO::PARAM_INT); break; case '`VIRTUAL_DOCUMENT`': $stmt->bindValue($identifier, $this->virtual_document, 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[LocalPickupShippingTableMap::ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . LocalPickupShippingTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(LocalPickupShippingTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } if ($this->isColumnModified(LocalPickupShippingTableMap::PRICE)) { $modifiedColumns[':p' . $index++] = 'PRICE'; } if ($this->isColumnModified(LocalPickupShippingTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } if ($this->isColumnModified(LocalPickupShippingTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; } $sql = sprintf('INSERT INTO local_pickup_shipping (%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 'PRICE': $stmt->bindValue($identifier, $this->price, 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); }
/** * 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_NAME)) { $modifiedColumns[':p' . $index++] = 'name'; } if ($this->isColumnModified(UserTableMap::COL_EMAIL)) { $modifiedColumns[':p' . $index++] = 'email'; } if ($this->isColumnModified(UserTableMap::COL_PASSWORD)) { $modifiedColumns[':p' . $index++] = 'password'; } if ($this->isColumnModified(UserTableMap::COL_REMEMBER)) { $modifiedColumns[':p' . $index++] = 'remember'; } if ($this->isColumnModified(UserTableMap::COL_ACCOUNT_TYPE)) { $modifiedColumns[':p' . $index++] = 'account_type'; } if ($this->isColumnModified(UserTableMap::COL_CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'created_at'; } if ($this->isColumnModified(UserTableMap::COL_UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'updated_at'; } $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 'name': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case 'email': $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR); break; case 'password': $stmt->bindValue($identifier, $this->password, PDO::PARAM_STR); break; case 'remember': $stmt->bindValue($identifier, $this->remember, PDO::PARAM_STR); break; case 'account_type': $stmt->bindValue($identifier, $this->account_type, 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[WpUsersTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . WpUsersTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(WpUsersTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_LOGIN)) { $modifiedColumns[':p' . $index++] = 'user_login'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_PASS)) { $modifiedColumns[':p' . $index++] = 'user_pass'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_NICENAME)) { $modifiedColumns[':p' . $index++] = 'user_nicename'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_EMAIL)) { $modifiedColumns[':p' . $index++] = 'user_email'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_URL)) { $modifiedColumns[':p' . $index++] = 'user_url'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_REGISTERED)) { $modifiedColumns[':p' . $index++] = 'user_registered'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_ACTIVATION_KEY)) { $modifiedColumns[':p' . $index++] = 'user_activation_key'; } if ($this->isColumnModified(WpUsersTableMap::COL_USER_STATUS)) { $modifiedColumns[':p' . $index++] = 'user_status'; } if ($this->isColumnModified(WpUsersTableMap::COL_DISPLAY_NAME)) { $modifiedColumns[':p' . $index++] = 'display_name'; } $sql = sprintf('INSERT INTO wp_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 'user_login': $stmt->bindValue($identifier, $this->user_login, PDO::PARAM_STR); break; case 'user_pass': $stmt->bindValue($identifier, $this->user_pass, PDO::PARAM_STR); break; case 'user_nicename': $stmt->bindValue($identifier, $this->user_nicename, PDO::PARAM_STR); break; case 'user_email': $stmt->bindValue($identifier, $this->user_email, PDO::PARAM_STR); break; case 'user_url': $stmt->bindValue($identifier, $this->user_url, PDO::PARAM_STR); break; case 'user_registered': $stmt->bindValue($identifier, $this->user_registered ? $this->user_registered->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case 'user_activation_key': $stmt->bindValue($identifier, $this->user_activation_key, PDO::PARAM_STR); break; case 'user_status': $stmt->bindValue($identifier, $this->user_status, PDO::PARAM_INT); break; case 'display_name': $stmt->bindValue($identifier, $this->display_name, 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); }
/** * 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[OrderAddressTableMap::ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderAddressTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderAddressTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderAddressTableMap::CUSTOMER_TITLE_ID)) { $modifiedColumns[':p' . $index++] = '`CUSTOMER_TITLE_ID`'; } if ($this->isColumnModified(OrderAddressTableMap::COMPANY)) { $modifiedColumns[':p' . $index++] = '`COMPANY`'; } if ($this->isColumnModified(OrderAddressTableMap::FIRSTNAME)) { $modifiedColumns[':p' . $index++] = '`FIRSTNAME`'; } if ($this->isColumnModified(OrderAddressTableMap::LASTNAME)) { $modifiedColumns[':p' . $index++] = '`LASTNAME`'; } if ($this->isColumnModified(OrderAddressTableMap::ADDRESS1)) { $modifiedColumns[':p' . $index++] = '`ADDRESS1`'; } if ($this->isColumnModified(OrderAddressTableMap::ADDRESS2)) { $modifiedColumns[':p' . $index++] = '`ADDRESS2`'; } if ($this->isColumnModified(OrderAddressTableMap::ADDRESS3)) { $modifiedColumns[':p' . $index++] = '`ADDRESS3`'; } if ($this->isColumnModified(OrderAddressTableMap::ZIPCODE)) { $modifiedColumns[':p' . $index++] = '`ZIPCODE`'; } if ($this->isColumnModified(OrderAddressTableMap::CITY)) { $modifiedColumns[':p' . $index++] = '`CITY`'; } if ($this->isColumnModified(OrderAddressTableMap::PHONE)) { $modifiedColumns[':p' . $index++] = '`PHONE`'; } if ($this->isColumnModified(OrderAddressTableMap::CELLPHONE)) { $modifiedColumns[':p' . $index++] = '`CELLPHONE`'; } if ($this->isColumnModified(OrderAddressTableMap::COUNTRY_ID)) { $modifiedColumns[':p' . $index++] = '`COUNTRY_ID`'; } if ($this->isColumnModified(OrderAddressTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderAddressTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf('INSERT INTO `order_address` (%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 '`CUSTOMER_TITLE_ID`': $stmt->bindValue($identifier, $this->customer_title_id, PDO::PARAM_INT); break; case '`COMPANY`': $stmt->bindValue($identifier, $this->company, PDO::PARAM_STR); break; case '`FIRSTNAME`': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); break; case '`LASTNAME`': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); break; case '`ADDRESS1`': $stmt->bindValue($identifier, $this->address1, PDO::PARAM_STR); break; case '`ADDRESS2`': $stmt->bindValue($identifier, $this->address2, PDO::PARAM_STR); break; case '`ADDRESS3`': $stmt->bindValue($identifier, $this->address3, PDO::PARAM_STR); break; case '`ZIPCODE`': $stmt->bindValue($identifier, $this->zipcode, PDO::PARAM_STR); break; case '`CITY`': $stmt->bindValue($identifier, $this->city, PDO::PARAM_STR); break; case '`PHONE`': $stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR); break; case '`CELLPHONE`': $stmt->bindValue($identifier, $this->cellphone, PDO::PARAM_STR); break; case '`COUNTRY_ID`': $stmt->bindValue($identifier, $this->country_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); }
/** * 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[ItemTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . ItemTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ItemTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(ItemTableMap::COL_PURCHASE_ORDER_ID)) { $modifiedColumns[':p' . $index++] = 'purchase_order_id'; } if ($this->isColumnModified(ItemTableMap::COL_UPC)) { $modifiedColumns[':p' . $index++] = 'upc'; } if ($this->isColumnModified(ItemTableMap::COL_QTY)) { $modifiedColumns[':p' . $index++] = 'qty'; } if ($this->isColumnModified(ItemTableMap::COL_DISCOUNT)) { $modifiedColumns[':p' . $index++] = 'discount'; } $sql = sprintf('INSERT INTO item (%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 'purchase_order_id': $stmt->bindValue($identifier, $this->purchase_order_id, PDO::PARAM_INT); break; case 'upc': $stmt->bindValue($identifier, $this->upc, PDO::PARAM_STR); break; case 'qty': $stmt->bindValue($identifier, $this->qty, PDO::PARAM_INT); break; case 'discount': $stmt->bindValue($identifier, $this->discount, 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); }
/** * 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[CustomerTableMap::ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . CustomerTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CustomerTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CustomerTableMap::REF)) { $modifiedColumns[':p' . $index++] = '`REF`'; } if ($this->isColumnModified(CustomerTableMap::TITLE_ID)) { $modifiedColumns[':p' . $index++] = '`TITLE_ID`'; } if ($this->isColumnModified(CustomerTableMap::FIRSTNAME)) { $modifiedColumns[':p' . $index++] = '`FIRSTNAME`'; } if ($this->isColumnModified(CustomerTableMap::LASTNAME)) { $modifiedColumns[':p' . $index++] = '`LASTNAME`'; } if ($this->isColumnModified(CustomerTableMap::EMAIL)) { $modifiedColumns[':p' . $index++] = '`EMAIL`'; } if ($this->isColumnModified(CustomerTableMap::PASSWORD)) { $modifiedColumns[':p' . $index++] = '`PASSWORD`'; } if ($this->isColumnModified(CustomerTableMap::ALGO)) { $modifiedColumns[':p' . $index++] = '`ALGO`'; } if ($this->isColumnModified(CustomerTableMap::RESELLER)) { $modifiedColumns[':p' . $index++] = '`RESELLER`'; } if ($this->isColumnModified(CustomerTableMap::LANG)) { $modifiedColumns[':p' . $index++] = '`LANG`'; } if ($this->isColumnModified(CustomerTableMap::SPONSOR)) { $modifiedColumns[':p' . $index++] = '`SPONSOR`'; } if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) { $modifiedColumns[':p' . $index++] = '`DISCOUNT`'; } if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) { $modifiedColumns[':p' . $index++] = '`REMEMBER_ME_TOKEN`'; } if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) { $modifiedColumns[':p' . $index++] = '`REMEMBER_ME_SERIAL`'; } if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CustomerTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(CustomerTableMap::VERSION)) { $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(CustomerTableMap::VERSION_CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(CustomerTableMap::VERSION_CREATED_BY)) { $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf('INSERT INTO `customer` (%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 '`REF`': $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); break; case '`TITLE_ID`': $stmt->bindValue($identifier, $this->title_id, PDO::PARAM_INT); break; case '`FIRSTNAME`': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); break; case '`LASTNAME`': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); break; case '`EMAIL`': $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR); break; case '`PASSWORD`': $stmt->bindValue($identifier, $this->password, PDO::PARAM_STR); break; case '`ALGO`': $stmt->bindValue($identifier, $this->algo, PDO::PARAM_STR); break; case '`RESELLER`': $stmt->bindValue($identifier, $this->reseller, PDO::PARAM_INT); break; case '`LANG`': $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); break; case '`SPONSOR`': $stmt->bindValue($identifier, $this->sponsor, PDO::PARAM_STR); break; case '`DISCOUNT`': $stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR); break; case '`REMEMBER_ME_TOKEN`': $stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR); break; case '`REMEMBER_ME_SERIAL`': $stmt->bindValue($identifier, $this->remember_me_serial, 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); } try { $pk = $con->lastInsertId(); } catch (Exception $e) { throw new PropelException('Unable to get autoincrement id.', 0, $e); } $this->setId($pk); $this->setNew(false); }
/** * 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); }
/** * Insert the row in the database. * * @param ConnectionInterface $con * * @throws PropelException * @see doSave() */ protected function doInsert(ConnectionInterface $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[отображаемыетипытехникимтрTableMap::COL_ID] = true; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . отображаемыетипытехникимтрTableMap::COL_ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(отображаемыетипытехникимтрTableMap::COL_ID)) { $modifiedColumns[':p' . $index++] = 'id'; } if ($this->isColumnModified(отображаемыетипытехникимтрTableMap::COL_ОТОБРАЖАЕМЫЙ_ТИП_ТЕХНИКИ)) { $modifiedColumns[':p' . $index++] = 'Отображаемый_тип_техники'; } $sql = sprintf('INSERT INTO Отображаемые_типы_техники_МТР (%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 'Отображаемый_тип_техники': $stmt->bindValue($identifier, $this->отображаемый_тип_техники, 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); }
/** * 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); }
/** * 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_ID_MEMBER)) { $modifiedColumns[':p' . $index++] = 'id_member'; } if ($this->isColumnModified(UserTableMap::COL_USERNAME)) { $modifiedColumns[':p' . $index++] = 'username'; } if ($this->isColumnModified(UserTableMap::COL_MEMBER_FROM)) { $modifiedColumns[':p' . $index++] = 'member_from'; } if ($this->isColumnModified(UserTableMap::COL_URL)) { $modifiedColumns[':p' . $index++] = 'url'; } if ($this->isColumnModified(UserTableMap::COL_EMAIL)) { $modifiedColumns[':p' . $index++] = 'email'; } if ($this->isColumnModified(UserTableMap::COL_EMAIL_CONFIRMED_AT)) { $modifiedColumns[':p' . $index++] = 'email_confirmed_at'; } if ($this->isColumnModified(UserTableMap::COL_EMAIL_CONFIRM_TOKEN)) { $modifiedColumns[':p' . $index++] = 'email_confirm_token'; } if ($this->isColumnModified(UserTableMap::COL_EMAIL_CHANGE_TOKEN)) { $modifiedColumns[':p' . $index++] = 'email_change_token'; } if ($this->isColumnModified(UserTableMap::COL_PASSWORD)) { $modifiedColumns[':p' . $index++] = 'password'; } if ($this->isColumnModified(UserTableMap::COL_PASSWORD_RESET_TOKEN)) { $modifiedColumns[':p' . $index++] = 'password_reset_token'; } if ($this->isColumnModified(UserTableMap::COL_PERMISSIONS)) { $modifiedColumns[':p' . $index++] = 'permissions'; } if ($this->isColumnModified(UserTableMap::COL_SIGNIN_COUNT)) { $modifiedColumns[':p' . $index++] = 'signin_count'; } if ($this->isColumnModified(UserTableMap::COL_ID_IMAGE)) { $modifiedColumns[':p' . $index++] = 'id_image'; } if ($this->isColumnModified(UserTableMap::COL_LAST_SIGNIN_AT)) { $modifiedColumns[':p' . $index++] = 'last_signin_at'; } if ($this->isColumnModified(UserTableMap::COL_CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'created_at'; } if ($this->isColumnModified(UserTableMap::COL_UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'updated_at'; } $sql = sprintf('INSERT INTO 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 'id_member': $stmt->bindValue($identifier, $this->id_member, PDO::PARAM_INT); break; case 'username': $stmt->bindValue($identifier, $this->username, PDO::PARAM_STR); break; case 'member_from': $stmt->bindValue($identifier, $this->member_from ? $this->member_from->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case 'url': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; case 'email': $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR); break; case 'email_confirmed_at': $stmt->bindValue($identifier, $this->email_confirmed_at ? $this->email_confirmed_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; case 'email_confirm_token': $stmt->bindValue($identifier, $this->email_confirm_token, PDO::PARAM_STR); break; case 'email_change_token': $stmt->bindValue($identifier, $this->email_change_token, PDO::PARAM_STR); break; case 'password': $stmt->bindValue($identifier, $this->password, PDO::PARAM_STR); break; case 'password_reset_token': $stmt->bindValue($identifier, $this->password_reset_token, PDO::PARAM_STR); break; case 'permissions': $stmt->bindValue($identifier, $this->permissions, PDO::PARAM_INT); break; case 'signin_count': $stmt->bindValue($identifier, $this->signin_count, PDO::PARAM_INT); break; case 'id_image': $stmt->bindValue($identifier, $this->id_image, PDO::PARAM_INT); break; case 'last_signin_at': $stmt->bindValue($identifier, $this->last_signin_at ? $this->last_signin_at->format("Y-m-d H:i:s") : null, 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); }