protected function assertCommonRelation(EntityBuilder $builder, $property, $annotationName, $targetEntity) { $this->assertTrue($builder->hasProperty($property), 'Builder hat property: ' . $property . ' nicht.'); $property = $builder->getProperty($property); $this->assertNotNull($property->getDocBlock(), 'DocBlock des Properties: ' . $property->getName() . ' ist nicht gesetzt'); $this->assertInstanceOf('Webforge\\Types\\Type', $type = $property->getType(), 'Type des Properties: ' . $property->getName() . ' ist nicht gesetzt'); if ($type->getName() === 'PersistentCollection') { $innerType = $type->getType(); $this->assertInstanceof('Webforge\\Types\\ObjectType', $innerType); $this->assertEquals($targetEntity, $innerType->getClass()->getFQN()); } elseif ($type->getName() === 'Entity') { $this->assertEquals($targetEntity, $type->getClass()->getFQN()); } else { $this->fail('Type (' . $type->getName() . ') ist weder Collection noch Object für Property: ' . $property->getName()); } $relationAnnotation = $this->assertHasDCAnnotation($property->getDocBlock(), $annotationName); $this->assertEquals($targetEntity, $relationAnnotation->targetEntity, 'Target Entity stimmt nicht überein'); return $relationAnnotation; }