/** * @param ClassMetadata $targetClass * @param array $assoc * @param mixed $actualValue * * @return self */ public static function invalidAssociation(ClassMetadata $targetClass, $assoc, $actualValue) { $expectedType = 'Doctrine\\Common\\Collections\\Collection|array'; if (($assoc['association'] & ClassMetadata::TO_ONE) > 0) { $expectedType = $targetClass->getName(); } return new self(sprintf('Expected value of type "%s" for association field "%s#$%s", got "%s" instead.', $expectedType, $assoc['sourceDoc'], $assoc['fieldName'], is_object($actualValue) ? get_class($actualValue) : gettype($actualValue))); }
function testGetName() { $this->assertEquals(Mapped::class, $this->metadata->getName()); }
/** * Validate runtime metadata is correctly defined. * * @param ClassMetadata $class * @param ClassMetadata|null $parent * * @return void * * @throws MappingException */ protected function validateRuntimeMetadata($class, $parent) { $className = $class->getName(); if ($this->isEntity($class) && empty($class->identifier)) { throw MappingException::missingRidProperty($className); } if ($class->isDocument() && !isset($class->orientClass)) { throw MappingException::missingOClass($className); } }
/** * Returns the POPO class associated with this repository. * * @return string */ public function getClassName() { return $this->metadata->getName(); }