/** * Посетить все Property ентити * * @param Entity $entity * @return array */ public function visitPropertyValidatorIntoEntity(Entity $entity) { $result = []; foreach ($entity->getProperties() as $property) { $result[$property->getName()] = $this->getPropertyVisitor()->visit($property); } return $result; }
public static function createBasedOnDescription($entityDescription) { $entity = new Entity(); if (!array_key_exists('properties', $entityDescription)) { throw EntityFactoryException::descriptionMustContainsProperty(); } foreach ($entityDescription['properties'] as $propertyName => $rules) { $entity->addProperty(PropertyFactory::create($propertyName, $rules)); } return $entity; }