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


PHP sfPropel类代码示例

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


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

示例1: modifyDatabase

 /**
  * Looks for tables marked as I18N and adds behaviors.
  */
 public function modifyDatabase()
 {
     $translationBehavior = sfPropel::importClass($this->getBuildProperty('propel.behavior.symfony_i18n_translation.class'));
     foreach ($this->getDatabase()->getTables() as $table) {
         $behaviors = $table->getBehaviors();
         if (!isset($behaviors['symfony_i18n']) && 'true' == $table->getAttribute('isI18N')) {
             $i18nTable = $this->getDatabase()->getTable($table->getAttribute('i18nTable'));
             // add the current behavior to the translatable model
             $behavior = clone $this;
             $behavior->setParameters(array('i18n_table' => $i18nTable->getName()));
             $table->addBehavior($behavior);
             // add the translation behavior to the translation model
             $behavior = new $translationBehavior();
             $behavior->setName('symfony_i18n_translation');
             $behavior->setParameters(array('culture_column' => $this->getCultureColumn($i18nTable)->getName()));
             $i18nTable->addBehavior($behavior);
         }
     }
 }
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:22,代码来源:SfPropelBehaviorI18n.php

示例2: modifyDatabase

 public function modifyDatabase()
 {
     foreach ($this->getDatabase()->getTables() as $table) {
         $behaviors = $table->getBehaviors();
         if (!isset($behaviors['symfony'])) {
             $behavior = clone $this;
             $table->addBehavior($behavior);
         }
         // symfony behaviors
         if (!isset($behaviors['symfony_behaviors']) && $this->getBuildProperty('propel.builder.addBehaviors')) {
             $class = sfPropel::importClass($this->getBuildProperty('propel.behavior.symfony_behaviors.class'));
             $behavior = new $class();
             $behavior->setName('symfony_behaviors');
             $table->addBehavior($behavior);
         }
         // timestampable
         if (!isset($behaviors['symfony_timestampable'])) {
             $parameters = array();
             foreach ($table->getColumns() as $column) {
                 if (!isset($parameters['create_column']) && in_array($column->getName(), array('created_at', 'created_on'))) {
                     $parameters['create_column'] = $column->getName();
                 }
                 if (!isset($parameters['update_column']) && in_array($column->getName(), array('updated_at', 'updated_on'))) {
                     $parameters['update_column'] = $column->getName();
                 }
             }
             if ($parameters) {
                 $class = sfPropel::importClass($this->getBuildProperty('propel.behavior.symfony_timestampable.class'));
                 $behavior = new $class();
                 $behavior->setName('symfony_timestampable');
                 $behavior->setParameters($parameters);
                 $table->addBehavior($behavior);
             }
         }
     }
 }
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:36,代码来源:SfPropelBehaviorSymfony.php

示例3: doSelectWithI18n

 /**
  * Selects a collection of {@link Product} objects with a {@link ProductI18n} translation populated.
  *
  * @param Criteria  $criteria
  * @param string    $culture
  * @param PropelPDO $con
  * @param string    $join_behavior
  *
  * @return array
  */
 public static function doSelectWithI18n(Criteria $criteria, $culture = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     if (null === $culture) {
         $culture = sfPropel::getDefaultCulture();
     }
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     ProductPeer::addSelectColumns($criteria);
     $startcol = ProductPeer::NUM_COLUMNS - ProductPeer::NUM_LAZY_LOAD_COLUMNS;
     ProductI18nPeer::addSelectColumns($criteria);
     $criteria->addJoin(ProductPeer::ID, ProductI18nPeer::ID, $join_behavior);
     $criteria->add(ProductI18nPeer::CULTURE, $culture);
     foreach (sfMixer::getCallables('BaseProduct:doSelectJoin:doSelectJoin') as $sf_hook) {
         call_user_func($sf_hook, 'Product', $criteria, $con);
     }
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = ProductPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = ProductPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = ProductPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             ProductPeer::addInstanceToPool($obj1, $key1);
         }
         // if $obj1 already loaded
         $key2 = ProductI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
         if ($key2 !== null) {
             $obj2 = ProductI18nPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = ProductI18nPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol);
                 ProductI18nPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 already loaded
             $obj1->setTranslationForCulture($obj2, $culture);
         }
         // if joined row was not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
开发者ID:Tony-M,项目名称:GrannySymfony,代码行数:61,代码来源:BaseProductPeer.php

示例4: getCurrentphysicalObjectI18n

 public function getCurrentphysicalObjectI18n(array $options = array())
 {
     if (!empty($options['sourceCulture'])) {
         $options['culture'] = $this->sourceCulture;
     }
     if (!isset($options['culture'])) {
         $options['culture'] = sfPropel::getDefaultCulture();
     }
     $physicalObjectI18ns = $this->physicalObjectI18ns->indexBy('culture');
     if (!isset($physicalObjectI18ns[$options['culture']])) {
         $physicalObjectI18ns[$options['culture']] = new QubitPhysicalObjectI18n();
     }
     return $physicalObjectI18ns[$options['culture']];
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:14,代码来源:BasePhysicalObject.php

示例5: getCurrentaccessionI18n

 public function getCurrentaccessionI18n(array $options = array())
 {
     if (!empty($options['sourceCulture'])) {
         $options['culture'] = $this->sourceCulture;
     }
     if (!isset($options['culture'])) {
         $options['culture'] = sfPropel::getDefaultCulture();
     }
     $accessionI18ns = $this->accessionI18ns->indexBy('culture');
     if (!isset($accessionI18ns[$options['culture']])) {
         $accessionI18ns[$options['culture']] = new QubitAccessionI18n();
     }
     return $accessionI18ns[$options['culture']];
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:14,代码来源:BaseAccession.php

示例6: getCurrentMovieI18n

 public function getCurrentMovieI18n($culture = null)
 {
     if (is_null($culture)) {
         $culture = is_null($this->culture) ? sfPropel::getDefaultCulture() : $this->culture;
     }
     if (!isset($this->current_i18n[$culture])) {
         $obj = MovieI18nPeer::retrieveByPK($this->getId(), $culture);
         if ($obj) {
             $this->setMovieI18nForCulture($obj, $culture);
         } else {
             $this->setMovieI18nForCulture(new MovieI18n(), $culture);
             $this->current_i18n[$culture]->setCulture($culture);
         }
     }
     return $this->current_i18n[$culture];
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:16,代码来源:BaseMovie.php

示例7: doSelectWithI18n

 public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
 {
     if ($culture === null) {
         $culture = sfPropel::getDefaultCulture();
     }
     foreach (sfMixer::getCallables('BaseFakeForumPeer:doSelectJoin:doSelectJoin') as $callable) {
         call_user_func($callable, 'BaseFakeForumPeer', $c, $con);
     }
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     FakeForumPeer::addSelectColumns($c);
     $startcol = FakeForumPeer::NUM_COLUMNS - FakeForumPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     FakeForumI18nPeer::addSelectColumns($c);
     $c->addJoin(FakeForumPeer::ID, FakeForumI18nPeer::ID);
     $c->add(FakeForumI18nPeer::CULTURE, $culture);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = FakeForumPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $obj1->setCulture($culture);
         $omClass = FakeForumI18nPeer::getOMClass($rs, $startcol);
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol);
         $obj1->setFakeForumI18nForCulture($obj2, $culture);
         $obj2->setFakeForum($obj1);
         $results[] = $obj1;
     }
     return $results;
 }
开发者ID:rande,项目名称:sfSolrPlugin,代码行数:34,代码来源:BaseFakeForumPeer.php

示例8: getCurrentrepositoryI18n

 public function getCurrentrepositoryI18n(array $options = array())
 {
     if (!empty($options['sourceCulture'])) {
         $options['culture'] = $this->sourceCulture;
     }
     if (!isset($options['culture'])) {
         $options['culture'] = sfPropel::getDefaultCulture();
     }
     $repositoryI18ns = $this->repositoryI18ns->indexBy('culture');
     if (!isset($repositoryI18ns[$options['culture']])) {
         $repositoryI18ns[$options['culture']] = new QubitRepositoryI18n();
     }
     return $repositoryI18ns[$options['culture']];
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:14,代码来源:BaseRepository.php

示例9: getContext

 public function getContext($forceReload = false)
 {
     parent::getContext($forceReload);
     sfPropel::initialize($this->context->getEventDispatcher());
     return $this->context;
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:6,代码来源:i18nTest.php

示例10: getCurrentstaticPageI18n

 public function getCurrentstaticPageI18n(array $options = array())
 {
     if (!empty($options['sourceCulture'])) {
         $options['culture'] = $this->sourceCulture;
     }
     if (!isset($options['culture'])) {
         $options['culture'] = sfPropel::getDefaultCulture();
     }
     $staticPageI18ns = $this->staticPageI18ns->indexBy('culture');
     if (!isset($staticPageI18ns[$options['culture']])) {
         $staticPageI18ns[$options['culture']] = new QubitStaticPageI18n();
     }
     return $staticPageI18ns[$options['culture']];
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:14,代码来源:BaseStaticPage.php

示例11: isExistent

 /**
  * Determine if a property matching passed values already exists.
  *
  * @param integer $objectId foreign key to QubitObject::ID
  * @param string $name  name of property
  * @param string $value value of property
  * @param string $options array of optional parameters
  * @return boolean true if QubitProperty exists
  */
 public static function isExistent($objectId, $name, $value, $options = array())
 {
     $propertyExists = false;
     $criteria = new Criteria();
     $criteria->addJoin(QubitProperty::ID, QubitPropertyI18n::ID);
     $criteria->add(QubitProperty::OBJECT_ID, $objectId);
     $criteria->add(QubitProperty::NAME, $name);
     $criteria->add(QubitPropertyI18n::VALUE, $value);
     if (isset($options['culture'])) {
         $criteria->add(QubitPropertyI18n::CULTURE, $options['culture']);
     } else {
         if (isset($options['sourceCulture'])) {
             $criteria->add(QubitPropertyI18n::CULTURE, QubitProperty::SOURCE_CULTURE . ' = ' . QubitPropertyI18n::CULTURE, Criteria::CUSTOM);
         } else {
             $criteria->add(QubitPropertyI18n::CULTURE, sfPropel::getDefaultCulture());
         }
     }
     if (isset($options['scope'])) {
         $criteria->add(QubitProperty::SCOPE, $options['scope']);
     }
     // See if search returns a hit.
     if (($property = QubitProperty::getOne($criteria)) !== null) {
         $propertyExists = true;
     }
     return $propertyExists;
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:35,代码来源:QubitProperty.php

示例12: doSelectWithI18n

 public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
 {
     if ($culture === null) {
         $culture = sfPropel::getDefaultCulture();
     }
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MoviePeer::addSelectColumns($c);
     $startcol = MoviePeer::NUM_COLUMNS - MoviePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     MovieI18nPeer::addSelectColumns($c);
     $c->addJoin(MoviePeer::ID, MovieI18nPeer::ID);
     $c->add(MovieI18nPeer::CULTURE, $culture);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = MoviePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $obj1->setCulture($culture);
         $omClass = MovieI18nPeer::getOMClass($rs, $startcol);
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol);
         $obj1->setMovieI18nForCulture($obj2, $culture);
         $obj2->setMovie($obj1);
         $results[] = $obj1;
     }
     return $results;
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:31,代码来源:BaseMoviePeer.php

示例13: insert

 protected function insert($connection = null)
 {
     if (!isset($connection)) {
         $connection = QubitTransactionFilter::getConnection(QubitOaiHarvest::DATABASE_NAME);
     }
     $offset = 0;
     foreach ($this->tables as $table) {
         $criteria = new Criteria();
         foreach ($table->getColumns() as $column) {
             if (!array_key_exists($column->getPhpName(), $this->values)) {
                 if ('createdAt' == $column->getPhpName() || 'updatedAt' == $column->getPhpName()) {
                     $this->values[$column->getPhpName()] = new DateTime();
                 }
                 if ('sourceCulture' == $column->getPhpName()) {
                     $this->values['sourceCulture'] = sfPropel::getDefaultCulture();
                 }
             }
             if (array_key_exists($column->getPhpName(), $this->values)) {
                 if (null !== ($param = $this->param($column))) {
                     $criteria->add($column->getFullyQualifiedName(), $param);
                 }
             }
             $offset++;
         }
         if (null !== ($id = BasePeer::doInsert($criteria, $connection))) {
             // Guess that the first primary key of the first table is auto
             // incremented
             if ($this->tables[0] == $table) {
                 $columns = $table->getPrimaryKeyColumns();
                 $this->values[$columns[0]->getPhpName()] = $this->keys[$columns[0]->getPhpName()] = $id;
             }
         }
     }
     return $this;
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:35,代码来源:BaseOaiHarvest.php

示例14: doSelectWithI18n

 public static function doSelectWithI18n(Criteria $c, $culture = null, PropelPDO $con = null)
 {
     $c = clone $c;
     if ($culture === null) {
         $culture = sfPropel::getDefaultCulture();
     }
     foreach (sfMixer::getCallables('BaseProductPeer:doSelectJoin:doSelectJoin') as $callable) {
         call_user_func($callable, 'BaseProductPeer', $c, $con);
     }
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ProductPeer::addSelectColumns($c);
     $startcol = ProductPeer::NUM_COLUMNS - ProductPeer::NUM_LAZY_LOAD_COLUMNS;
     ProductI18nPeer::addSelectColumns($c);
     $c->addJoin(ProductPeer::ID, ProductI18nPeer::ID);
     $c->add(ProductI18nPeer::CULTURE, $culture);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $omClass = ProductPeer::getOMClass();
         $cls = Propel::importClass($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($row);
         $obj1->setCulture($culture);
         $omClass = ProductI18nPeer::getOMClass();
         $cls = Propel::importClass($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($row, $startcol);
         $obj1->setProductI18nForCulture($obj2, $culture);
         $obj2->setProduct($obj1);
         $results[] = $obj1;
     }
     return $results;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:35,代码来源:BaseProductPeer.php

示例15: getCurrentMovieI18n

 /**
  * Returns the current translation.
  *
  * @return MovieI18n
  */
 public function getCurrentMovieI18n($culture = null)
 {
     if (null === $culture) {
         $culture = null === $this->culture ? sfPropel::getDefaultCulture() : $this->culture;
     }
     if (!isset($this->current_i18n[$culture])) {
         $object = $this->isNew() ? null : MovieI18nPeer::retrieveByPK($this->getPrimaryKey(), $culture);
         if ($object) {
             $this->setMovieI18nForCulture($object, $culture);
         } else {
             $this->setMovieI18nForCulture(new MovieI18n(), $culture);
             $this->current_i18n[$culture]->setCulture($culture);
         }
     }
     return $this->current_i18n[$culture];
 }
开发者ID:br00k,项目名称:yavom,代码行数:21,代码来源:BaseMovie.php


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