ConnectionInterface PHP Class Code Examples

This page contains top rated real world PHP examples of class ConnectionInterface extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: DefaultPlatform.php Project: dracony/forked-php-orm-benchmark
0
 /**
  * Default constructor.
  *
  * @param ConnectionInterface $con Optional database connection to use in this platform.
  */
 public function __construct(ConnectionInterface $con = null)
 {
     if (null !== $con) {
         $this->setConnection($con);
     }
     $this->initialize();
 }
Example #2
Show file File: CouponCountryTableMap.php Project: margery/thelia
0
 /**
  * Performs an INSERT on the database, given a CouponCountry or Criteria object.
  *
  * @param mixed               $criteria Criteria or CouponCountry object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(CouponCountryTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from CouponCountry object
     }
     // Set the correct dbName
     $query = CouponCountryQuery::create()->mergeWith($criteria);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = $query->doInsert($con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
Example #3
Show file File: ModuleManagement.php Project: vigourouxjulien/thelia
0
 private function saveDescription(Module $module, \SimpleXMLElement $content, ConnectionInterface $con)
 {
     foreach ($content->descriptive as $description) {
         $locale = (string) $description->attributes()->locale;
         $module->setLocale($locale)->setTitle($description->title)->setDescription(isset($description->description) ? $description->description : null)->setPostscriptum(isset($description->postscriptum) ? $description->postscriptum : null)->setChapo(isset($description->subtitle) ? $description->subtitle : null)->save($con);
     }
 }
Example #4
Show file File: ProductSaleElementsProductDocumentTableMap.php Project: margery/thelia
0
 /**
  * Performs an INSERT on the database, given a ProductSaleElementsProductDocument or Criteria object.
  *
  * @param mixed               $criteria Criteria or ProductSaleElementsProductDocument object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(ProductSaleElementsProductDocumentTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from ProductSaleElementsProductDocument object
     }
     if ($criteria->containsKey(ProductSaleElementsProductDocumentTableMap::ID) && $criteria->keyContainsValue(ProductSaleElementsProductDocumentTableMap::ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProductSaleElementsProductDocumentTableMap::ID . ')');
     }
     // Set the correct dbName
     $query = ProductSaleElementsProductDocumentQuery::create()->mergeWith($criteria);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = $query->doInsert($con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
Example #5
Show file File: DiaporamaVersionTableMap.php Project: InformatiqueProg/Diaporamas
0
 /**
  * Performs an INSERT on the database, given a DiaporamaVersion or Criteria object.
  *
  * @param mixed               $criteria Criteria or DiaporamaVersion object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(DiaporamaVersionTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from DiaporamaVersion object
     }
     // Set the correct dbName
     $query = DiaporamaVersionQuery::create()->mergeWith($criteria);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = $query->doInsert($con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
Example #6
Show file File: ModuleImageTableMap.php Project: shirone/thelia
0
 /**
  * Performs an INSERT on the database, given a ModuleImage or Criteria object.
  *
  * @param mixed               $criteria Criteria or ModuleImage object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(ModuleImageTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from ModuleImage object
     }
     if ($criteria->containsKey(ModuleImageTableMap::ID) && $criteria->keyContainsValue(ModuleImageTableMap::ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ModuleImageTableMap::ID . ')');
     }
     // Set the correct dbName
     $query = ModuleImageQuery::create()->mergeWith($criteria);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = $query->doInsert($con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
Frequently Used Methods