/** * Sets the requirements for a channel * * @param string $class * @param FamilyInterface $family * @param string $channelCode * @param array $attributeCodes */ protected function setChannelRequirements($class, FamilyInterface $family, $channelCode, $attributeCodes) { foreach ($attributeCodes as $attributeCode) { $data = ['attribute' => $attributeCode, 'channel' => $channelCode, 'required' => true]; $requirement = $this->transformNestedEntity($class, 'requirements', $this->requirementClass, $data); if ($requirement->getAttribute() === null) { throw new \Exception(sprintf('The attribute "%s" used as requirement in family "%s" is not known', $attributeCode, $family->getCode())); } $family->addAttributeRequirement($requirement); } }