/** * @param Definition $definition * @param Property $property * @throws InvalidArgumentException */ private function validateAssociation(Definition $definition, Property $property) { if ($property->isAssociated()) { $targetClass = (string) $property->getAssociation()->getTargetClassName(); if (!array_key_exists($targetClass, $this->entityDefinitions)) { throw new InvalidArgumentException(sprintf("Entity class \"%s\" used in association of \"%s\" entity does not have definition.", $targetClass, (string) $definition->getClassName())); } } }