public function testGenerate()
 {
     $schema = ['relationData' => [['field_id' => new FieldConfigId('extend', 'Test\\Entity', ExtendHelper::buildAssociationName('Test\\TargetEntity1', self::ASSOCIATION_KIND), 'manyToOne'), 'target_entity' => 'Test\\TargetEntity1'], ['field_id' => new FieldConfigId('extend', 'Test\\Entity', ExtendHelper::buildAssociationName('Test\\TargetEntity2', self::ASSOCIATION_KIND), 'manyToOne'), 'target_entity' => 'Test\\TargetEntity2'], ['field_id' => new FieldConfigId('extend', 'Test\\Entity', ExtendHelper::buildAssociationName('Test\\TargetEntity3', self::ASSOCIATION_KIND), 'manyToMany'), 'target_entity' => 'Test\\TargetEntity3'], ['field_id' => new FieldConfigId('extend', 'Test\\Entity', 'testField', 'manyToOne'), 'target_entity' => 'Test\\TargetEntity4']]];
     $class = PhpClass::create('Test\\Entity');
     $this->extension->generate($schema, $class);
     $strategy = new DefaultGeneratorStrategy();
     $classBody = $strategy->generate($class);
     $expectedBody = file_get_contents(__DIR__ . '/../Fixtures/multiple_many_to_one_association.txt');
     $this->assertEquals(trim($expectedBody), $classBody);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function generate(array $schema, PhpClass $class)
 {
     $class->addInterfaceName('Oro\\Bundle\\ActivityBundle\\Model\\ActivityInterface');
     parent::generate($schema, $class);
 }