当前位置: 首页>>代码示例>>PHP>>正文


PHP BasePeer类代码示例

本文整理汇总了PHP中BasePeer的典型用法代码示例。如果您正苦于以下问题:PHP BasePeer类的具体用法?PHP BasePeer怎么用?PHP BasePeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BasePeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete(PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(sfGuardGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($this->isDefaultGroup()) {
         throw new sfException('Cannot remove default group (ID ' . $this->id . ')!');
         return false;
     }
     /*
      * get default group
      *
      */
     $default_group = sfGuardGroupPeer::getDefaultGroup();
     //get default group
     /*
      * check if servers has this group
      * If servers found remove reference to group to be deleted
      */
     $con->beginTransaction();
     try {
         //select from...
         $c1 = new Criteria();
         $c1->add(EtvaServerPeer::SF_GUARD_GROUP_ID, $this->getId());
         //update set
         $c2 = new Criteria();
         $c2->add(EtvaServerPeer::SF_GUARD_GROUP_ID, $default_group->getId());
         BasePeer::doUpdate($c1, $c2, $con);
         parent::delete($con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:35,代码来源:sfGuardGroup.php

示例2: doUpdateAllModerations

 public static function doUpdateAllModerations($selectCriteria, $values, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     return BasePeer::doUpdate($selectCriteria, $values, $con);
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:moderationPeer.php

示例3: assertCriteriaTranslation

 protected function assertCriteriaTranslation($criteria, $expectedSql, $expectedParams, $message = '')
 {
     $params = array();
     $result = BasePeer::createSelectSql($criteria, $params);
     $this->assertEquals($expectedSql, $result, $message);
     $this->assertEquals($expectedParams, $params, $message);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:7,代码来源:ModelCriteriaWithSchemaTest.php

示例4: execute

 protected function execute($arguments = array(), $options = array())
 {
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', 'dev', true));
     parent::execute($arguments, $options);
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $con = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     $this->log('[INFO] Checking VirtAgents state...' . "\n");
     $offset = sfConfig::get('app_node_keepalive_update') + sfConfig::get('app_node_keepalive_update_offset');
     $total_nodes = EtvaNodePeer::doCount(new Criteria());
     if ($total_nodes > 0) {
         $con->beginTransaction();
         $affected = 0;
         try {
             $offset_date = date("c", time() - $offset);
             /*
              * get nodes that have last_keepalive field outdated
              */
             $c1 = new Criteria();
             $c1->add(EtvaNodePeer::LAST_KEEPALIVE, $offset_date, Criteria::LESS_THAN);
             $c1->add(EtvaNodePeer::STATE, EtvaNode::NODE_ACTIVE);
             // only active
             //update statement
             $c2 = new Criteria();
             $c2->add(EtvaNodePeer::STATE, EtvaNode::NODE_INACTIVE);
             $affected += BasePeer::doUpdate($c1, $c2, $con);
             // update maintenance and running to maintenance
             $c1 = new Criteria();
             $c1->add(EtvaNodePeer::LAST_KEEPALIVE, $offset_date, Criteria::LESS_THAN);
             $c1->add(EtvaNodePeer::STATE, EtvaNode::NODE_MAINTENANCE_UP);
             //update statement
             $c2 = new Criteria();
             $c2->add(EtvaNodePeer::STATE, EtvaNode::NODE_MAINTENANCE);
             $affected += BasePeer::doUpdate($c1, $c2, $con);
             // update fail and running to fail
             $c1 = new Criteria();
             $c1->add(EtvaNodePeer::LAST_KEEPALIVE, $offset_date, Criteria::LESS_THAN);
             $c1->add(EtvaNodePeer::STATE, EtvaNode::NODE_FAIL_UP);
             // only active
             //update statement
             $c2 = new Criteria();
             $c2->add(EtvaNodePeer::STATE, EtvaNode::NODE_FAIL);
             $affected += BasePeer::doUpdate($c1, $c2, $con);
             $con->commit();
             $message = sprintf('%d Node(s) NOT received update in time offset of %d seconds', $affected, $offset);
             if ($affected > 0) {
                 $context->getEventDispatcher()->notify(new sfEvent(sfConfig::get('config_acronym'), 'event.log', array('message' => $message, 'priority' => EtvaEventLogger::ERR)));
             }
             $this->log('[INFO]' . $message);
         } catch (PropelException $e) {
             $con->rollBack();
             throw $e;
         }
     }
     $logger = new sfFileLogger($context->getEventDispatcher(), array('file' => sfConfig::get("sf_log_dir") . '/cron_status.log'));
     // log the message!
     $logger->log("[INFO] The check virtAgents task ran!", 6);
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:59,代码来源:nodeChecknodeskeepaliveTask.class.php

示例5: getNotas

 public function getNotas($ciclolectivo_id)
 {
     $notaAlumno = array();
     $notaActividad = array();
     // notas del alumno
     $criteria = new Criteria();
     $criteria->add(BoletinActividadesPeer::FK_ALUMNO_ID, $this->getId());
     $criteria->add(PeriodoPeer::CALCULAR, false);
     $criteria->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $ciclolectivo_id);
     $criteria->addJoin(BoletinActividadesPeer::FK_ESCALANOTA_ID, EscalanotaPeer::ID);
     $criteria->addJoin(BoletinActividadesPeer::FK_PERIODO_ID, PeriodoPeer::ID);
     $criteria->addAsColumn("boletinActividades_periodo_id", BoletinActividadesPeer::FK_PERIODO_ID);
     $criteria->addAsColumn("boletinActividades_actividad_id", BoletinActividadesPeer::FK_ACTIVIDAD_ID);
     $criteria->addAsColumn("escalanota_nombre", EscalanotaPeer::NOMBRE);
     $aBoletinActividades = BasePeer::doSelect($criteria);
     foreach ($aBoletinActividades as $boletinActividades) {
         $notaAlumno[$boletinActividades[0]][$boletinActividades[1]] = $boletinActividades[2];
         $notaActividad[$boletinActividades[1]][$boletinActividades[0]] = $boletinActividades[2];
     }
     $c = new Criteria();
     $c->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $ciclolectivo_id);
     $c->add(PeriodoPeer::CALCULAR, true);
     $periodos = PeriodoPeer::doSelect($c);
     foreach ($notaActividad as $act_indice => &$act) {
         foreach ($periodos as $periodo) {
             //validar que esten ok
             if (trim($periodo->getFormula()) != '') {
                 list($class_formula, $parametros) = explode('|', $periodo->getFormula());
                 $parametros = explode(',', $parametros);
                 //if (array_intersect($parametros,array_keys($act)) == $parametros) {
                 sfContext::getInstance()->getLogger()->debug("estan todo slo ids");
                 $class_formula = "formula_{$class_formula}";
                 require_once sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'formulas' . DIRECTORY_SEPARATOR . $class_formula . ".class.php";
                 $formula = new $class_formula();
                 $notas_parametros = array();
                 foreach ($parametros as $parametro) {
                     if (isset($act[$parametro])) {
                         array_push($notas_parametros, sprintf("%01.2f", str_replace(",", ".", $act[$parametro])));
                     } else {
                         array_push($notas_parametros, '');
                     }
                 }
                 $nota = $formula->calcular($notas_parametros);
                 $notaAlumno[$periodo->getId()][$act_indice] = $nota;
                 $act[$periodo->getId()] = $nota;
                 //}
                 //else {
                 //    sfContext::getInstance()->getLogger()->debug('faltan parametros para la formula');
                 //}
             } else {
                 sfContext::getInstance()->getLogger()->debug('el periodo es calculable pero no tiene una formula cargada');
             }
         }
     }
     return $notaAlumno;
 }
开发者ID:mediasadc,项目名称:alba,代码行数:56,代码来源:Alumno.php

示例6: testDoInsert

 public function testDoInsert()
 {
     try {
         $c = new Criteria();
         $c->setPrimaryTableName(BookPeer::TABLE_NAME);
         $c->add(BookPeer::AUTHOR_ID, 'lkhlkhj');
         BasePeer::doInsert($c, Propel::getConnection());
     } catch (PropelException $e) {
         $this->assertContains('[INSERT INTO `book` (`AUTHOR_ID`) VALUES (:p1)]', $e->getMessage(), 'SQL query is written in the exception message');
     }
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:11,代码来源:BasePeerExceptionsTest.php

示例7: testApplyLimitDuplicateColumnName

 public function testApplyLimitDuplicateColumnName()
 {
     Propel::setDb('oracle', new DBOracle());
     $c = new Criteria();
     $c->setDbName('oracle');
     BookPeer::addSelectColumns($c);
     AuthorPeer::addSelectColumns($c);
     $c->setLimit(1);
     $params = array();
     $sql = BasePeer::createSelectSql($c, $params);
     $this->assertEquals('SELECT B.* FROM (SELECT A.*, rownum AS PROPEL_ROWNUM FROM (SELECT book.ID AS book_ID, book.TITLE AS book_TITLE, book.ISBN AS book_ISBN, book.PRICE AS book_PRICE, book.PUBLISHER_ID AS book_PUBLISHER_ID, book.AUTHOR_ID AS book_AUTHOR_ID, author.ID AS author_ID, author.FIRST_NAME AS author_FIRST_NAME, author.LAST_NAME AS author_LAST_NAME, author.EMAIL AS author_EMAIL, author.AGE AS author_AGESELECT book.ID, book.TITLE, book.ISBN, book.PRICE, book.PUBLISHER_ID, book.AUTHOR_ID, author.ID, author.FIRST_NAME, author.LAST_NAME, author.EMAIL, author.AGE FROM book, author) A ) B WHERE  B.PROPEL_ROWNUM <= 1', $sql, 'applyLimit() creates a subselect with aliased column names when a duplicate column name is found');
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:12,代码来源:DBOracleTest.php

示例8: checkForRepeatedNames

 public function checkForRepeatedNames($validator, $value)
 {
     $criteria = new Criteria();
     $criteria->add(QubitTerm::ID, $this->resource->id, Criteria::NOT_EQUAL);
     $criteria->add(QubitTerm::TAXONOMY_ID, $this->resource->taxonomyId);
     $criteria->addJoin(QubitTerm::ID, QubitTermI18n::ID);
     $criteria->add(QubitTermI18n::CULTURE, $this->context->user->getCulture());
     $criteria->add(QubitTermI18n::NAME, $value);
     if (0 < intval(BasePeer::doCount($criteria)->fetchColumn(0))) {
         throw new sfValidatorError($validator, $this->context->i18n->__('Name - A term with this name already exists.'));
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:12,代码来源:indexAction.class.php

示例9: execute

 public function execute($request)
 {
     if (!isset($request->limit)) {
         $request->limit = sfConfig::get('app_hits_per_page');
     }
     $this->resource = $this->getRoute()->resource;
     $criteria = new Criteria();
     $criteria->add(QubitRelation::SUBJECT_ID, $this->resource->id);
     $criteria->add(QubitRelation::TYPE_ID, QubitTerm::HAS_PHYSICAL_OBJECT_ID);
     $criteria->addJoin(QubitRelation::OBJECT_ID, QubitInformationObject::ID);
     $this->informationObjects = QubitInformationObject::get($criteria);
     $c2 = clone $criteria;
     $this->foundcount = BasePeer::doCount($c2)->fetchColumn(0);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:14,代码来源:boxListAction.class.php

示例10: entryDeleted

 /**
  * @param int $entryId
  */
 protected function entryDeleted($entryId)
 {
     $c = new Criteria();
     $c->add(CuePointPeer::ENTRY_ID, $entryId);
     CuePointPeer::setUseCriteriaFilter(false);
     $cuePoints = CuePointPeer::doSelect($c);
     $update = new Criteria();
     $update->add(CuePointPeer::STATUS, CuePointStatus::DELETED);
     $con = Propel::getConnection(myDbHelper::DB_HELPER_CONN_MASTER);
     BasePeer::doUpdate($c, $update, $con);
     foreach ($cuePoints as $cuePoint) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($cuePoint));
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:17,代码来源:kCuePointManager.php

示例11: testApplyLimitDuplicateColumnNameWithColumn

 public function testApplyLimitDuplicateColumnNameWithColumn()
 {
     Propel::setDb('oracle', new DBOracle());
     $c = new Criteria();
     $c->setDbName('oracle');
     BookPeer::addSelectColumns($c);
     AuthorPeer::addSelectColumns($c);
     $c->addAsColumn('BOOK_PRICE', BookPeer::PRICE);
     $c->setLimit(1);
     $params = array();
     $asColumns = $c->getAsColumns();
     $sql = BasePeer::createSelectSql($c, $params);
     $this->assertEquals('SELECT B.* FROM (SELECT A.*, rownum AS PROPEL_ROWNUM FROM (SELECT book.id AS ORA_COL_ALIAS_0, book.title AS ORA_COL_ALIAS_1, book.isbn AS ORA_COL_ALIAS_2, book.price AS ORA_COL_ALIAS_3, book.publisher_id AS ORA_COL_ALIAS_4, book.author_id AS ORA_COL_ALIAS_5, author.id AS ORA_COL_ALIAS_6, author.first_name AS ORA_COL_ALIAS_7, author.last_name AS ORA_COL_ALIAS_8, author.email AS ORA_COL_ALIAS_9, author.age AS ORA_COL_ALIAS_10, book.price AS BOOK_PRICE FROM book, author) A ) B WHERE  B.PROPEL_ROWNUM <= 1', $sql, 'applyLimit() creates a subselect with aliased column names when a duplicate column name is found');
     $this->assertEquals($asColumns, $c->getAsColumns(), 'createSelectSql supplementary add alias column');
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:15,代码来源:DBOracleTest.php

示例12: entryDeleted

 /**
  * @param int $entryId
  */
 protected function entryDeleted($entryId)
 {
     $c = new Criteria();
     $c->add(AnnotationPeer::ENTRY_ID, $entryId);
     $c->add(AnnotationPeer::STATUS, AnnotationStatus::ANNOTATION_STATUS_DELETED, Criteria::NOT_EQUAL);
     AnnotationPeer::setUseCriteriaFilter(false);
     $annotations = AnnotationPeer::doSelect($c);
     foreach ($annotations as $annotation) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($annotation));
     }
     $update = new Criteria();
     $update->add(AnnotationPeer::STATUS, AnnotationStatus::ANNOTATION_STATUS_DELETED);
     $con = Propel::getConnection(AnnotationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     BasePeer::doUpdate($c, $update, $con);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:18,代码来源:kAnnotationManager.php

示例13: getCriteriaCacheKey

 public static function getCriteriaCacheKey(Criteria $c)
 {
     $cloned_c = clone $c;
     $arr = array();
     $str = BasePeer::createSelectSql($c, $arr);
     $param_map = array();
     $keys = $c->keys();
     foreach ($keys as $k) {
         $val = $c->getCriterion($k);
         if ($val) {
             $param_map[$k] = $val->hashCode();
         }
     }
     $str .= print_r($param_map, true);
     $cache_key = md5($str);
     return $cache_key;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:17,代码来源:myCriteria.class.php

示例14: deleteMetadataObjects

 /**
  * @param int $objectType
  * @param string $objectId
  */
 protected function deleteMetadataObjects($objectType, $objectId)
 {
     $c = new Criteria();
     $c->add(MetadataPeer::OBJECT_TYPE, $objectType);
     $c->add(MetadataPeer::OBJECT_ID, $objectId);
     $c->add(MetadataPeer::STATUS, Metadata::STATUS_DELETED, Criteria::NOT_EQUAL);
     $peer = null;
     MetadataPeer::setUseCriteriaFilter(false);
     $metadatas = MetadataPeer::doSelect($c);
     foreach ($metadatas as $metadata) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($metadata));
     }
     $update = new Criteria();
     $update->add(MetadataPeer::STATUS, Metadata::STATUS_DELETED);
     $con = Propel::getConnection(MetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     BasePeer::doUpdate($c, $update, $con);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:21,代码来源:kMetadataObjectDeletedHandler.php

示例15: setJobStateIds

 public static function setJobStateIds($jobs, $stateId)
 {
     $c1 = new Criteria();
     $c2 = new Criteria();
     $c1->add(JobPeer::ID, $jobs, Criteria::IN);
     $c2->add(JobPeer::STATUS_ID, $stateId);
     BasePeer::doUpdate($c1, $c2, Propel::getConnection());
     $state = StatusPeer::retrieveByPK($stateId);
     foreach ($jobs as $id) {
         $logEntry = new Log();
         $logEntry->setWhen(time());
         $logEntry->setPropelClass("Job");
         $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
         $logEntry->setMessage("Changed job state to " . $state->getState());
         $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_change_status"));
         $logEntry->setPropelId($id);
         $logEntry->save();
     }
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:19,代码来源:JobPeer.php


注:本文中的BasePeer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。