protected function initOrm()
 {
     // force id = 1
     $metadata = $this->em->getClassMetaData(CollectionType::class);
     $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $this->collectionType1 = $this->createCollectionType(1, 'collection.default', 'Default Collection Type', 'Default Collection Type');
     $this->collectionType2 = $this->createCollectionType(2, 'collection.system', 'System Collections');
     $this->em->persist($this->collectionType1);
     $this->em->persist($this->collectionType2);
     $this->em->flush();
     $this->collection1 = $this->createCollection($this->collectionType1, ['en-gb' => 'Test Collection', 'de' => 'Test Kollektion']);
 }
Esempio n. 2
0
 /**
  * persistAndFlushEntitites
  * 
  * Method cascading the persits of every entities updated during the process of one annonce. 
  *  
  * @param void
  */
 private function persistAndFlushEntitites()
 {
     $this->oEm->getClassMetaData(get_class($this->oAgenceEntity))->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $this->oEm->getClassMetaData(get_class($this->oNegociateurEntity))->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $this->oEm->getClassMetaData(get_class($this->oAnnonceEntity))->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $this->oEm->persist($this->oAgenceEntity);
     $this->oNegociateurEntity->setAgence($this->oAgenceEntity);
     $this->oEm->persist($this->oNegociateurEntity);
     $this->oAnnonceEntity->setAgence($this->oAgenceEntity);
     $this->oAnnonceEntity->setNegociateur($this->oNegociateurEntity);
     $this->oEm->persist($this->oAnnonceEntity);
     $this->oEm->flush();
     $this->iNbAnnonceTraite++;
 }
Esempio n. 3
0
 /**
  * @param string|object $entity
  */
 protected function forceAssignedIds($entity)
 {
     $metadata = $this->manager->getClassMetaData(is_string($entity) ? $entity : get_class($entity));
     $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE);
 }