Ejemplo n.º 1
0
 public function testIsCollectionTrueWhenManyToOneDefinedBySourceEntity()
 {
     $className = 'Foo\\Entity';
     $sourceClassName = 'Bar\\Entity';
     $this->entityMetadata->expects($this->once())->method('getClassName')->will($this->returnValue($className));
     $this->fieldMetadata->setEntityMetadata($this->entityMetadata);
     $this->fieldMetadata->set('source_class_name', $sourceClassName);
     $this->doctrineMetadata->expects($this->once())->method('isAssociation')->will($this->returnValue(true));
     $this->doctrineMetadata->expects($this->once())->method('isManyToMany')->will($this->returnValue(false));
     $this->doctrineMetadata->expects($this->once())->method('isManyToOne')->will($this->returnValue(true));
     $this->assertTrue($this->fieldMetadata->isCollection());
 }
Ejemplo n.º 2
0
 /**
  * @param FieldMetadata $fieldMetadata
  */
 public function addFieldMetadata(FieldMetadata $fieldMetadata)
 {
     $fieldMetadata->setEntityMetadata($this);
     $this->fieldsMetadata[$fieldMetadata->getFieldName()] = $fieldMetadata;
 }