/**
  * Advances the curesor in the statement
  * Closes the cursor if the end of the statement is reached
  */
 public function next()
 {
     $this->currentRow = $this->stmt->fetch(PDO::FETCH_NUM);
     $this->currentKey++;
     $this->isValid = (bool) $this->currentRow;
     if (!$this->isValid) {
         $this->closeCursor();
         if ($this->enableInstancePoolingOnFinish) {
             Propel::enableInstancePooling();
         }
     }
 }
 public function testInstancePoolingReenabled()
 {
     Propel::enableInstancePooling();
     $books = PropelQuery::from('Book')->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find($this->con);
     foreach ($books as $book) {
     }
     $this->assertTrue(Propel::isInstancePoolingEnabled());
     Propel::disableInstancePooling();
     $books = PropelQuery::from('Book')->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find($this->con);
     foreach ($books as $book) {
     }
     $this->assertFalse(Propel::isInstancePoolingEnabled());
     Propel::enableInstancePooling();
 }
 public function setUp()
 {
     parent::setUp();
     $a = new Author();
     $a->setFirstName("Douglas");
     $a->setLastName("Adams");
     $b1 = new Book();
     $b1->setTitle("The Hitchhikers Guide To The Galaxy");
     $a->addBook($b1);
     $b2 = new Book();
     $b2->setTitle("The Restaurant At The End Of The Universe");
     $a->addBook($b2);
     $a->save();
     $this->author = $a;
     $this->books = array($b1, $b2);
     Propel::enableInstancePooling();
     // Clear author instance pool so the object would be fetched from the database
     AuthorPeer::clearInstancePool();
 }
 /**
  * Configures a Propel datasource.
  *
  * @param array  $parameters The datasource parameters
  * @param string $name       The datasource name
  */
 public function initialize($parameters = null, $name = 'propel')
 {
     parent::initialize($parameters);
     if (!$this->hasParameter('datasource') && $this->hasParameter('name')) {
         $this->setParameter('datasource', $this->getParameter('name'));
     } elseif (!$this->hasParameter('datasource') && !empty($name)) {
         $this->setParameter('datasource', $name);
     }
     $this->addConfig();
     // mark the first connection as the default
     if (!Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT)->getParameter('datasources.default')) {
         $this->setDefaultConfig();
     }
     // for BC
     if ($this->getParameter('pooling', false)) {
         Propel::enableInstancePooling();
     } else {
         Propel::disableInstancePooling();
     }
 }
Example #5
0
 /**
  * Populate the database using all the Entity classes previously added.
  *
  * @param PropelPDO $con A Propel connection object
  *
  * @return array A list of the inserted PKs
  */
 public function execute($con = null)
 {
     if (null === $con) {
         $con = $this->getConnection();
     }
     $isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled();
     \Propel::disableInstancePooling();
     $insertedEntities = array();
     $con->beginTransaction();
     foreach ($this->quantities as $class => $number) {
         for ($i = 0; $i < $number; $i++) {
             $insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities);
         }
     }
     $con->commit();
     if ($isInstancePoolingEnabled) {
         \Propel::enableInstancePooling();
     }
     return $insertedEntities;
 }
Example #6
0
    /**
    * Test that PropelCollection->add() prevents duplicates of objects strictly identical
    *
    */
   public function testAdd()
    {
        Propel::disableInstancePooling();
        $eleve1 = EleveQuery::create()->findOneByLogin('Florence Michu');
        $eleve1->setNom('test_different');
        $eleve_col = new PropelCollection();
        $eleve_col->add($eleve1);
        $eleve1idem = EleveQuery::create()->findOneByLogin('Florence Michu');
        $this->assertFalse($eleve_col->contains($eleve1idem));
        $eleve_col->add($eleve1idem);
        $this->assertEquals(2, count($eleve_col));
        Propel::enableInstancePooling();


        $eleve1 = EleveQuery::create()->findOneByLogin('Florence Michu');
        $eleve_col = new PropelCollection();
        $eleve_col->add($eleve1);
        $eleve_col->add($eleve1);
        $this->assertEquals(1, count($eleve_col));
    }
 /**
  * Initializes sfPropelDatabase by loading configuration and initializing Propel
  *
  * @param array $parameters The datasource parameters
  * @param string $name The datasource name
  *
  * @return void
  */
 public function initialize($parameters = null, $name = 'propel')
 {
     parent::initialize($parameters);
     if (!$this->hasParameter('datasource') && $this->hasParameter('name')) {
         $this->setParameter('datasource', $this->getParameter('name'));
     } elseif (!$this->hasParameter('datasource') && !empty($name)) {
         $this->setParameter('datasource', $name);
     }
     $this->addConfig();
     $is_default = $this->getParameter('is_default', false);
     // first defined if none listed as default
     if ($is_default || 1 == count(self::$config['propel']['datasources'])) {
         $this->setDefaultConfig();
     }
     Propel::setConfiguration(self::$config[$name]);
     if ($this->getParameter('pooling', false)) {
         Propel::enableInstancePooling();
     } else {
         Propel::disableInstancePooling();
     }
     if (!Propel::isInit()) {
         Propel::initialize();
     }
 }
Example #8
0
 public function close(array $errors = array(), PropelPDO $con = null)
 {
     $con = is_null($con) ? Propel::getConnection() : $con;
     $c = new Criteria();
     $c->add(CareerSchoolYearPeer::ID, $this->getId());
     $c->addJoin(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID);
     $c->addJoin(StudentPeer::ID, StudentCareerSchoolYearPeer::STUDENT_ID);
     //$c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::IN_COURSE);
     $c->add(StudentCareerSchoolYearPeer::IS_PROCESSED, false);
     $c->setDistinct(StudentPeer::ID);
     sfConfig::set('sf_logging_enabled', FALSE);
     $cant = 0;
     try {
         $pager = new sfPropelPager('Student', 500);
         $pager->setCriteria($c);
         $pager->init();
         $last_page = $pager->getLastPage();
         for ($i = 1; $i <= $last_page; $i++) {
             $pager->setPage($i);
             $pager->init();
             $students = $pager->getResults();
             $con->beginTransaction();
             Propel::disableInstancePooling();
             foreach ($students as $student) {
                 $cant++;
                 $student_errors = $student->getErrorsWithCourseSubjectsStudent($this);
                 //si el alumno tiene errores guardo el error y sigo evaluando a los demas alumnos
                 if (!empty($student_errors)) {
                     $errors[$student->getId()] = $student_errors;
                     if (count($errors) > sfConfig::get('app_close_course_subject_schol_year_max_error')) {
                         throw new Exception('Maximo de errores alcanzado >' . sfConfig::get('app_close_course_subject_schol_year_max_error'));
                     }
                 } else {
                     $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $this);
                     //si el alumno tiene reserva de banco no deberia hacer nada.
                     if ($student_career_school_year->getStatus() != StudentCareerSchoolYearStatus::WITHDRAWN_WITH_RESERVE) {
                         $student->closeCareerSchoolYear($this, $con);
                         $student_career_school_year->setIsProcessed(true);
                         $student_career_school_year->save($con);
                         $student_career_school_year->clearAllReferences(true);
                         unset($student_career_school_year);
                     }
                 }
                 ####Liberando memoria###
                 $student->clearAllReferences(true);
                 unset($student_errors);
                 unset($student);
                 ##################*/
             }
             ####Liberando memoria###
             StudentPeer::clearInstancePool();
             unset($students);
             ##############################
             $con->commit();
         }
         if (count($errors)) {
             throw new Exception('Hay errores no se puede cerrar el año!');
         }
         //Se setea a la carrera como procesada.
         $this->setIsProcessed(true);
         $this->save($con);
         Propel::enableInstancePooling();
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
     return true;
 }
    public function testHydrateOverwritePreviousValues()
    {
        $schema = <<<EOF
<database name="generated_object_complex_type_test_with_constructor">
    <table name="complex_column_type_entity_with_constructor">
        <column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
        <column name="tags" type="ARRAY" />
    </table>
</database>
EOF;
        $builder = new PropelQuickBuilder();
        $builder->setSchema($schema);
        $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query', 'peerstub', 'querystub'));
        $builder->build();
        require_once dirname(__FILE__) . '/fixtures/ComplexColumnTypeEntityWithConstructor.php';
        Propel::disableInstancePooling();
        // need to be disabled to test the hydrate() method
        $obj = new ComplexColumnTypeEntityWithConstructor();
        $this->assertEquals(array('foo', 'bar'), $obj->getTags());
        $obj->setTags(array('baz'));
        $this->assertEquals(array('baz'), $obj->getTags());
        $obj->save();
        $obj = ComplexColumnTypeEntityWithConstructorQuery::create()->findOne();
        $this->assertEquals(array('baz'), $obj->getTags());
        Propel::enableInstancePooling();
    }
 /**
  * Do converting
  * @param KalturaConvertJobData $data Job data
  * @return array Result of converting
  */
 public function convertJob(KalturaConvertJobData &$data)
 {
     $outputParams = $data->flavorParamsOutput;
     $videoCodec = $outputParams->videoCodec;
     $videoBitrate = $outputParams->videoBitrate;
     $width = $outputParams->width;
     $height = $outputParams->height;
     $presetName = $outputParams->name;
     $preset = array();
     $preset[kWAMS::CONVERT_PARAM_PRESET_NAME] = $outputParams->name;
     $preset[kWAMS::CONVERT_PARAM_AUDIO_CODEC] = $outputParams->audioCodec;
     $preset[kWAMS::CONVERT_PARAM_AUDIO_BITRATE] = $outputParams->audioBitrate;
     $preset[kWAMS::CONVERT_PARAM_AUDIO_CHANNELS] = $outputParams->audioChannels;
     $preset[kWAMS::CONVERT_PARAM_AUDIO_SAMPLE_RATE] = $outputParams->audioSampleRate;
     $preset[kWAMS::CONVERT_PARAM_VIDEO_CODEC] = $outputParams->videoCodec;
     $preset[kWAMS::CONVERT_PARAM_VIDEO_WIDTH] = $outputParams->width;
     $preset[kWAMS::CONVERT_PARAM_VIDEO_HEIGHT] = $outputParams->height;
     $preset[kWAMS::CONVERT_PARAM_VIDEO_BITRATE] = $outputParams->videoBitrate;
     KalturaLog::debug("Video params output: preset = [{$presetName}], videoCodec = [{$videoCodec}], videoBitrate = [{$videoBitrate}], width = [{$width}], height = [{$height}]");
     $start = microtime(true);
     $kWAMS = kWAMS::getInstance($data->flavorParamsOutput->partnerId);
     $wamsJobId = $kWAMS->addConvertJob($data->srcFileSyncWamsAssetId, $preset);
     Propel::disableInstancePooling();
     while ($kWAMS->isJobProcessing($wamsJobId)) {
         // check Kaltura Batch Job Status
         if (BatchJobPeer::retrieveByPK($this->batchJobId)->getAbort()) {
             $kWAMS->cancelJob($wamsJobId);
         }
         sleep(5);
     }
     Propel::enableInstancePooling();
     $data->destFileSyncWamsAssetId = $kWAMS->getOutputAssetId($wamsJobId);
     $end = microtime(true);
     $duration = $end - $start;
     KalturaLog::info($this->getName() . ":  took [{$duration}] seconds");
     return array(true, null);
 }
Example #11
0
 public function testFindPkCompositeKey()
 {
     BookstoreDataPopulator::depopulate();
     $c = new ModelCriteria('bookstore', 'BookListRel');
     $bookListRel = $c->findPk(array(1, 2));
     $this->assertNull($bookListRel, 'findPk() returns null when the composite primary key is not found');
     Propel::enableInstancePooling();
     BookstoreDataPopulator::populate();
     // save all books to make sure related objects are also saved - BookstoreDataPopulator keeps some unsaved
     $c = new ModelCriteria('bookstore', 'Book');
     $books = $c->find();
     foreach ($books as $book) {
         $book->save();
     }
     // retrieve the test data
     $c = new ModelCriteria('bookstore', 'BookListRel');
     $bookListRelTest = $c->findOne();
     $pk = $bookListRelTest->getPrimaryKey();
     $c = new ModelCriteria('bookstore', 'BookListRel');
     $bookListRel = $c->findPk($pk);
     $this->assertEquals($bookListRelTest, $bookListRel, 'findPk() can find objects with composite primary keys');
 }
 public function testFormatALotOfResults()
 {
     $nbBooks = 50;
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     Propel::disableInstancePooling();
     $book = new Book();
     for ($i = 0; $i < $nbBooks; $i++) {
         $book->clear();
         $book->setTitle('BookTest' . $i);
         $book->save($con);
     }
     $stmt = $con->query('SELECT * FROM book');
     $formatter = new PropelOnDemandFormatter();
     $formatter->init(new ModelCriteria('bookstore', 'Book'));
     $books = $formatter->format($stmt);
     $this->assertTrue($books instanceof PropelOnDemandCollection, 'PropelOnDemandFormatter::format() returns a PropelOnDemandCollection');
     $this->assertEquals($nbBooks, count($books), 'PropelOnDemandFormatter::format() returns a collection that counts as many rows as the results in the query');
     $i = 0;
     foreach ($books as $book) {
         $this->assertTrue($book instanceof Book, 'PropelOnDemandFormatter::format() returns a collection of Model objects');
         $this->assertEquals('BookTest' . $i, $book->getTitle(), 'PropelOnDemandFormatter::format() returns the model objects matching the query');
         $i++;
     }
     Propel::enableInstancePooling();
 }
 private static function checkDeletedEntry(FileSyncKey $target_key, $wams_asset_id = null, $file_path = null)
 {
     Propel::disableInstancePooling();
     $entry = self::getEntryForKey($target_key);
     Propel::enableInstancePooling();
     if (!is_null($entry) && $entry->getStatus() != entryStatus::DELETED) {
         return false;
     }
     if (!empty($wams_asset_id)) {
         kWAMS::getInstance($target_key->getPartnerId())->deleteAssetById($wams_asset_id);
     }
     if (!empty($file_path)) {
         unlink($file_path);
     }
     return true;
 }
 /**
  * Load Propel config
  * 
  * @param      AgaviDatabaseManager The database manager of this instance.
  * @param      array                An assoc array of initialization params.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.10.0
  */
 public function initialize(AgaviDatabaseManager $databaseManager, array $parameters = array())
 {
     parent::initialize($databaseManager, $parameters);
     $configPath = AgaviToolkit::expandDirectives($this->getParameter('config'));
     $datasource = $this->getParameter('datasource', null);
     $use_as_default = $this->getParameter('use_as_default', false);
     $config = (require $configPath);
     if ($datasource === null || $datasource == 'default') {
         if (isset($config['propel']['datasources']['default'])) {
             $datasource = $config['propel']['datasources']['default'];
         } elseif (isset($config['datasources']['default'])) {
             $datasource = $config['datasources']['default'];
         } else {
             throw new AgaviDatabaseException('No datasource given for Propel connection, and no default datasource specified in runtime configuration file.');
         }
     }
     if (!class_exists('Propel')) {
         include 'propel/Propel.php';
     }
     if (!Propel::isInit()) {
         Propel::init($configPath);
     }
     $is13 = version_compare(Propel::VERSION, '1.4', '<');
     // grab the configuration values and inject possibly defined overrides for this data source
     if ($is13) {
         // old-style config array; PropelConfiguration was added after 1.3.0, http://trac.agavi.org/ticket/1195
         $config = Propel::getConfiguration();
         $config['datasources'][$datasource]['adapter'] = $this->getParameter('overrides[adapter]', $config['datasources'][$datasource]['adapter']);
         $config['datasources'][$datasource]['connection'] = array_merge($config['datasources'][$datasource]['connection'], $this->getParameter('overrides[connection]', array()));
         // also the autoload classes
         $config['datasources'][$datasource]['classes'] = array_merge($config['datasources'][$datasource]['classes'], $this->getParameter('overrides[classes]', array()));
         // and init queries
         if (!isset($config['datasources'][$datasource]['connection']['settings']['queries']['query'])) {
             $config['datasources'][$datasource]['connection']['settings']['queries']['query'] = array();
         }
         // array cast because "query" might be a string if just one init query was given, http://trac.agavi.org/ticket/1194
         $config['datasources'][$datasource]['connection']['settings']['queries']['query'] = array_merge((array) $config['datasources'][$datasource]['connection']['settings']['queries']['query'], (array) $this->getParameter('init_queries'));
         // set the new config
         Propel::setConfiguration($config);
     } else {
         $config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
         $overrides = (array) $this->getParameter('overrides');
         // set override values
         foreach ($overrides as $key => $value) {
             $config->setParameter($key, $value);
         }
         // handle init queries in a cross-adapter fashion (they all support the "init_queries" param)
         $queries = (array) $config->getParameter('datasources.' . $datasource . '.connection.settings.queries.query', array());
         // yes... it's one array, [connection][settings][queries][query], with all the init queries from the config, so we append to that
         $queries = array_merge($queries, (array) $this->getParameter('init_queries'));
         $config->setParameter('datasources.' . $datasource . '.connection.settings.queries.query', $queries);
     }
     if (true === $this->getParameter('enable_instance_pooling')) {
         Propel::enableInstancePooling();
     } elseif (false === $this->getParameter('enable_instance_pooling')) {
         Propel::disableInstancePooling();
     }
 }
 public function testFindPkSimpleWithAbstractSingleTableInheritanceReturnCorrectClass()
 {
     Propel::disableInstancePooling();
     $manager = new DistributionManager();
     $manager->setName('manager1');
     $manager->save();
     $distributionStore = new DistributionStore();
     $distributionStore->setName('my store 1');
     $distributionStore->setDistributionManager($manager);
     $distributionStore->save();
     $distributionVirtualStore = new DistributionVirtualStore();
     $distributionVirtualStore->setName('my VirtualStore 1');
     $distributionVirtualStore->setDistributionManager($manager);
     $distributionVirtualStore->save();
     $this->assertInstanceOf('DistributionStore', DistributionQuery::create()->findPk($distributionStore->getId()), 'findPk() return right object : DistributionStore');
     $this->assertInstanceOf('DistributionVirtualStore', DistributionQuery::create()->findPk($distributionVirtualStore->getId()), 'findPk() return right object : DistributionVirtualStore');
     Propel::enableInstancePooling();
 }
 public function testFindOneWithDistantClass()
 {
     BookstoreDataPopulator::populate();
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     ReviewPeer::clearInstancePool();
     Propel::enableInstancePooling();
     $c = new ModelCriteria('bookstore', 'Review');
     $c->where('Review.Recommended = ?', true);
     $c->join('Review.Book');
     $c->with('Book');
     $c->join('Book.Author');
     $c->with('Author');
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     $review = $c->findOne($con);
     $count = $con->getQueryCount();
     $this->assertEquals($review->getReviewedBy(), 'Washington Post', 'Main object is correctly hydrated');
     $book = $review->getBook();
     $this->assertEquals($count, $con->getQueryCount(), 'with() hydrates the related objects to save a query');
     $this->assertEquals('Harry Potter and the Order of the Phoenix', $book->getTitle(), 'Related object is correctly hydrated');
     $author = $book->getAuthor();
     $this->assertEquals($count, $con->getQueryCount(), 'with() hydrates the related objects to save a query');
     $this->assertEquals('J.K.', $author->getFirstName(), 'Related object is correctly hydrated');
 }
 public function testDoSelectJoinOneToOne()
 {
     $con = Propel::getConnection();
     $count = $con->getQueryCount();
     Propel::disableInstancePooling();
     $c = new Criteria();
     $accs = BookstoreEmployeeAccountPeer::doSelectJoinBookstoreEmployee($c);
     Propel::enableInstancePooling();
     $this->assertEquals(1, $con->getQueryCount() - $count, 'doSelectJoin() makes only one query in a one-to-one relationship');
 }
 public function testFindOneWithDistantClassRenamedRelation()
 {
     BookstoreDataPopulator::populate();
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     ReviewPeer::clearInstancePool();
     Propel::enableInstancePooling();
     $c = new ModelCriteria('bookstore', 'BookSummary');
     $c->joinWith('BookSummary.SummarizedBook');
     $c->joinWith('SummarizedBook.Author');
     $c->setFormatter(ModelCriteria::FORMAT_ARRAY);
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     $summary = $c->findOne($con);
     $count = $con->getQueryCount();
     $this->assertEquals('Harry Potter does some amazing magic!', $summary['Summary'], 'Main object is correctly hydrated');
     $book = $summary['SummarizedBook'];
     $this->assertEquals($count, $con->getQueryCount(), 'with() hydrates the related objects to save a query');
     $this->assertEquals('Harry Potter and the Order of the Phoenix', $book['Title'], 'Related object is correctly hydrated');
     $author = $book['Author'];
     $this->assertEquals($count, $con->getQueryCount(), 'with() hydrates the related objects to save a query');
     $this->assertEquals('J.K.', $author['FirstName'], 'Related object is correctly hydrated');
 }
 private function addWamsFile(KalturaBatchJob $job, KalturaConvertJobData $data)
 {
     KalturaLog::debug("wams file({$job->id}, {$data->destFileSyncWamsAssetId})");
     if (empty($data->destFileSyncWamsAssetId)) {
         KalturaLog::err("Error: add wams file failed");
         die;
     } else {
         Propel::disableInstancePooling();
         if (BatchJobPeer::retrieveByPK($job->id)->getAbort()) {
             kWAMS::getInstance($job->partnerId)->deleteAssetById($data->destFileSyncWamsAssetId);
             return $job;
         }
         Propel::enableInstancePooling();
         $job->status = KalturaBatchJobStatus::FINISHED;
         $job->message = "File ready in WAMS";
         return $this->closeJob($job, null, null, $job->message, $job->status, $data);
     }
 }
 public function testParamConvertWithOptionWith()
 {
     $this->loadFixtures();
     $paramConverter = new PropelParamConverter();
     $request = new Request(array(), array(), array('id' => 1, 'book' => null));
     $configuration = new ParamConverter(array('class' => 'Propel\\PropelBundle\\Tests\\Request\\ParamConverter\\MyBook', 'name' => 'book', 'options' => array('with' => 'MyAuthor')));
     $nb = $this->con->getQueryCount();
     $paramConverter->apply($request, $configuration);
     $book = $request->attributes->get('book');
     $this->assertInstanceOf('Propel\\PropelBundle\\Tests\\Request\\ParamConverter\\MyBook', $book, 'param "book" should be an instance of "Propel\\PropelBundle\\Tests\\Request\\ParamConverter\\MyBook"');
     $this->assertEquals($nb + 1, $this->con->getQueryCount(), 'only one query to get the book');
     $this->assertInstanceOf('Propel\\PropelBundle\\Tests\\Request\\ParamConverter\\MyAuthor', $book->getMyAuthor(), 'param "book" should be an instance of "Propel\\PropelBundle\\Tests\\Request\\ParamConverter\\MyAuthor"');
     $this->assertEquals($nb + 1, $this->con->getQueryCount(), 'no new query to get the author');
     \Propel::enableInstancePooling();
 }
 protected function tearDown()
 {
     parent::tearDown();
     Propel::enableInstancePooling();
 }
Example #22
0
                    $ri = new RecipeIngredient();
                    $ri->setItem($item);
                    $ri->setCount($ingrow['Count']);
                    $ri->setRecipe($r);
                    $ri->save();
                    // mark the recipe
                    $ri->setOkOnImport();
                }
            }
        }
        // remove old ingredients that aren't in the import any more
        foreach ($oldRIs as $oldRI) {
            if (!$oldRI->getOkOnImport()) {
                $oldRI->delete();
            }
        }
        $r->save();
    } catch (Exception $e) {
        $failed[] = $row;
        echo "failed [[ {$e->getMessage()} ]] .. \n";
        print_r($e->getTrace());
    }
    if ($max && $i >= $max) {
        break;
    }
}
if (count($failed) > 0) {
    var_dump($failed);
}
Propel::enableInstancePooling();
Example #23
0
 public function testEquals() {
     Propel::disableInstancePooling();
     $eleve1 = EleveQuery::create()->findOneByLogin('Florence Michu');
     usleep(1);
     $eleve1idem = EleveQuery::create()->findOneByLogin('Florence Michu');
     $this->assertEquals($eleve1, $eleve1idem);
     Propel::enableInstancePooling();
 }
 public static function retrieveByPKsNoFilter($pks, $con = null)
 {
     self::$filerResults = true;
     self::setUseCriteriaFilter(false);
     Propel::disableInstancePooling();
     $res = parent::retrieveByPKs($pks, $con);
     Propel::enableInstancePooling();
     self::setUseCriteriaFilter(true);
     self::$filerResults = false;
     return $res;
 }