PropelPDO PHP Class Code Examples

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

Example #1
Show file File: BaseUnitTestCase.php Project: cwd/LexikTranslationBundle
0
 /**
  * @return \PropelPDO
  */
 protected function getMockPropelConnection()
 {
     if (!class_exists('Lexik\\Bundle\\TranslationBundle\\Propel\\om\\BaseFile')) {
         // classes are built in-memory.
         $builder = new \PropelQuickBuilder();
         $builder->setSchema(file_get_contents(__DIR__ . '/../../Resources/config/propel/schema.xml'));
         $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query'));
         $con = $builder->build();
     } else {
         // in memory-classes already exist, create connection and SQL manually
         $dsn = 'sqlite::memory:';
         $adapter = new \DBSQLite();
         $con = new \PropelPDO($dsn, null, null);
         $con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $name = 'default';
         if (!\Propel::isInit()) {
             \Propel::setConfiguration(array('datasources' => array('default' => $name)));
         }
         \Propel::setDB($name, $adapter);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_READ);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_WRITE);
         // don't rebuild classes
         $builder = new \PropelQuickBuilder();
         $builder->setSchema(file_get_contents(__DIR__ . '/../../Resources/config/propel/schema.xml'));
         $builder->buildSQL($con);
     }
     return $con;
 }
Example #2
Show file File: AppToken.php Project: DBezemer/server
0
 public function preUpdate(PropelPDO $con = null)
 {
     if ($this->isColumnModified(AppTokenPeer::STATUS) && $this->getStatus() == AppTokenStatus::DELETED) {
         $this->setDeleted(time());
     }
     return parent::preUpdate($con);
 }
Example #3
Show file File: BatchJob.php Project: DBezemer/server
0
 public function postUpdate(PropelPDO $con = null)
 {
     if (!$this->alreadyInSave && BatchJobLockPeer::shouldCreateLockObject($this, false, $con)) {
         BatchJobLockPeer::createLockObject($this);
     }
     return parent::postUpdate($con);
 }
Example #4
Show file File: SphinxLogServerPeer.php Project: DBezemer/server
0
 /**
  * Retrieve the server object of the current data center
  *
  * @param      string $server server name
  * @param      PropelPDO $con the connection to use
  * @return     SphinxLogServer
  */
 public static function retrieveByLocalServer($server, PropelPDO $con = null)
 {
     $criteria = new Criteria();
     $criteria->add(SphinxLogServerPeer::SERVER, $server);
     $criteria->add(SphinxLogServerPeer::DC, kDataCenterMgr::getCurrentDcId());
     return SphinxLogServerPeer::doSelectOne($criteria, $con);
 }
Example #5
Show file File: Tag.php Project: DBezemer/server
0
 public function postUpdate(PropelPDO $con = null)
 {
     parent::postUpdate($con);
     if (!$this->alreadyInSave) {
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($this));
     }
 }
Example #6
Show file File: kuserPeer.php Project: DBezemer/server
0
 public static function retrieveByPKNoFilter($pk, PropelPDO $con = null)
 {
     self::setUseCriteriaFilter(false);
     $ret = self::retrieveByPK($pk, $con);
     self::setUseCriteriaFilter(true);
     return $ret;
 }
Example #7
Show file File: kshow.php Project: DBezemer/server
0
 public function delete(PropelPDO $con = null)
 {
     if ($this->getName() != self::DUMMY_KSHOW_NAME) {
         myStatisticsMgr::deleteKshow($this);
     }
     parent::delete($con);
 }
Example #8
Show file File: accessControlPeer.php Project: DBezemer/server
0
 /**
  * @param array $pk
  * @param PropelPDO $con
  * @return array<accessControl>
  */
 public static function retrieveByPKsNoFilter($pks, PropelPDO $con = null)
 {
     self::setUseCriteriaFilter(false);
     $res = parent::retrieveByPKs($pks, $con);
     self::setUseCriteriaFilter(true);
     return $res;
 }
Example #9
Show file File: widgetPeer.php Project: DBezemer/server
0
 public static function retrieveByPKNoFilter($pk, PropelPDO $con = null, $join = null)
 {
     self::setUseCriteriaFilter(false);
     $res = self::retrieveByPK($pk, $con, $join);
     self::setUseCriteriaFilter(true);
     return $res;
 }
Example #10
Show file File: Partner.php Project: DBezemer/server
0
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->alreadyInSave) {
         return parent::postUpdate($con);
     }
     // update the owner kuser deatils if required
     $adminNameModified = $this->isColumnModified(PartnerPeer::ADMIN_NAME);
     $adminEmailModified = $this->isColumnModified(PartnerPeer::ADMIN_EMAIL);
     if ($adminNameModified || $adminEmailModified) {
         $ownerKuserId = $this->getAccountOwnerKuserId();
         if ($ownerKuserId) {
             $ownerKuser = kuserPeer::retrieveByPK($ownerKuserId);
             if ($adminNameModified) {
                 $ownerKuser->setFullName($this->getAdminName());
             }
             if ($adminEmailModified) {
                 $ownerKuser->setEmail($this->getAdminEmail());
             }
             $ownerKuser->save();
         }
     }
     $objectDeleted = false;
     if ($this->isColumnModified(PartnerPeer::STATUS) && $this->getStatus() == Partner::PARTNER_STATUS_DELETED) {
         $objectDeleted = true;
     }
     $ret = parent::postUpdate($con);
     if ($objectDeleted) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
     }
     return $ret;
 }
Example #11
Show file File: BaseTaula4.php Project: Esleelkartea/legedia-ESLE
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = Taula4Peer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setNew(false);
             } else {
                 $affectedRows += Taula4Peer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Example #12
Show file File: MediaServerNode.php Project: DBezemer/server
0
 public function preInsert(PropelPDO $con = null)
 {
     if ($this->getPartnerId() === Partner::MEDIA_SERVER_PARTNER_ID) {
         $this->setDc(kDataCenterMgr::getCurrentDcId());
     }
     return parent::preInsert($con);
 }
Example #13
Show file File: Ezer_PropelStepInstancePeer.php Project: reginaldoandrade/ezerphp
0
 /**
  * Retrieve all active child steps
  *
  * @param      PropelPDO $con the connection to use
  * @return     array<Ezer_PropelStepInstance>
  */
 public static function retrieveChildSteps($containerId, $containerType, PropelPDO $con = null)
 {
     $criteria = new Criteria();
     $criteria->add(Ezer_PropelStepInstancePeer::CONTAINER_INSTANCE_ID, $containerId);
     $criteria->add(Ezer_PropelStepInstancePeer::CONTAINER_INSTANCE_TYPE, $containerType);
     return self::doSelect($criteria, $con);
 }
Example #14
Show file File: AvnDistributionProfile.php Project: DBezemer/server
0
 public function preSave(PropelPDO $con = null)
 {
     if ($this->isNew()) {
         $this->setUniqueHashForFeedUrl(md5(time() . rand(0, time())));
     }
     return parent::preSave($con);
 }
Example #15
Show file File: asset.php Project: DBezemer/server
0
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->alreadyInSave) {
         return parent::postUpdate($con);
     }
     $statusChangedToReady = false;
     if ($this->isColumnModified(assetPeer::STATUS) && $this->getStatus() == self::FLAVOR_ASSET_STATUS_READY) {
         $statusChangedToReady = true;
     }
     $versionModified = false;
     if ($this->isColumnModified(assetPeer::VERSION)) {
         $versionModified = true;
     }
     $objectDeleted = false;
     if ($this->isColumnModified(assetPeer::STATUS) && $this->getStatus() == self::FLAVOR_ASSET_STATUS_DELETED || $this->isColumnModified(assetPeer::DELETED_AT) && !is_null($this->getDeletedAt(null))) {
         $objectDeleted = true;
     }
     $ret = parent::postUpdate($con);
     if ($objectDeleted) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
     }
     if ($statusChangedToReady || $versionModified || $objectDeleted) {
         $this->onAssetContentModified();
     }
     return $ret;
 }
Example #16
Show file File: BaseArticle.php Project: yasirgit/afids
0
 public function countAttachments(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(ArticlePeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collAttachments === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(AttachmentPeer::ARTICLE_ID, $this->id);
             $count = AttachmentPeer::doCount($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(AttachmentPeer::ARTICLE_ID, $this->id);
             if (!isset($this->lastAttachmentCriteria) || !$this->lastAttachmentCriteria->equals($criteria)) {
                 $count = AttachmentPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collAttachments);
             }
         } else {
             $count = count($this->collAttachments);
         }
     }
     return $count;
 }
Example #17
Show file File: BaseAuditLog.php Project: yasirgit/afids
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->isNew()) {
             $this->modifiedColumns[] = AuditLogPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = AuditLogPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += AuditLogPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }