public function testNotReferable() { $this->metadata->expects($this->once())->method('hasAssociation')->with($this->equalTo('property_path'))->will($this->returnValue(true)); $this->metadata->expects($this->any())->method('getAssociationMapping')->with($this->equalTo('property_path'))->will($this->returnValue(array('targetEntity' => 'target_entity', 'type' => ClassMetadataInfo::MANY_TO_MANY))); $repository = new \stdClass(); $this->doctrine->expects($this->once())->method('getRepository')->with($this->equalTo('target_entity'))->will($this->returnValue($repository)); $guesser = new RelationGuesser($this->transformer, $this->doctrine); $this->assertNull($guesser->getTransformerInfo($this->columnInfo, $this->metadata)); }
/** * {@inheritdoc} */ public function getTransformerInfo(ColumnInfoInterface $columnInfo, ClassMetadata $metadata) { if ($this->valueClass != $metadata->getName() || !in_array($columnInfo->getPropertyPath(), array('option', 'options'))) { return; } $info = parent::getTransformerInfo($columnInfo, $metadata); if ($info) { list($transformer, $options) = $info; $options['reference_prefix'] = $columnInfo->getName(); return array($transformer, $options); } return null; }