Exemple #1
0
 /**
  * initialize
  *
  * @see ClientInterface
  */
 public function initialize(Session $session)
 {
     $this->session = $session;
     if ($this->structure === null) {
         throw new ModelException(sprintf("Structure not set while initializing Model class '%s'.", get_class($this)));
     }
     if ($this->flexible_entity_class == null) {
         throw new ModelException(sprintf("Flexible entity not set while initializing Model class '%s'.", get_class($this)));
     } elseif (!(new \ReflectionClass($this->flexible_entity_class))->implementsInterface('\\PommProject\\ModelManager\\Model\\FlexibleEntity\\FlexibleEntityInterface')) {
         throw new ModelException(sprintf("Flexible entity must implement FlexibleEntityInterface."));
     }
     $session->getPoolerForType('converter')->getConverterHolder()->registerConverter($this->flexible_entity_class, new PgEntity($this->flexible_entity_class, $this->getStructure()), [$this->getStructure()->getRelation(), $this->flexible_entity_class]);
 }
Exemple #2
0
 protected function initializeSession(Session $session)
 {
     $session->getPoolerForType('converter')->getConverterHolder()->registerConverter('ComplexNumber', new PgEntity('\\PommProject\\ModelManager\\Test\\Fixture\\ComplexNumber', new ComplexNumberStructure()), ['pomm_test.complex_number']);
 }
Exemple #3
0
 /**
  * Because newTestedInstance cannot be called in setUp or tearDown methods,
  * we must set up session manually in test methods.
  */
 protected function setUpSession(Session $session)
 {
     $session->getPoolerForType('converter')->getConverterHolder()->registerConverter('ComplexNumber', $this->newTestedInstance('PommProject\\ModelManager\\Test\\Fixture\\ComplexNumber', new ComplexNumberStructure()), ['pomm_test.complex_number'])->registerConverter('ComplexFixture', $this->newTestedInstance('\\PommProject\\ModelManager\\Test\\Fixture\\ComplexFixture', new ComplexFixtureStructure()), ['complex_fixture']);
     return $session;
 }