/** * Check that unit families of 2 attributes are consistent. * * @param AttributeInterface $fromAttribute * @param AttributeInterface $toAttribute * @param string $type * * @throws \Pim\Bundle\CatalogBundle\Exception\InvalidArgumentException */ protected function checkUnitFamily(AttributeInterface $fromAttribute, AttributeInterface $toAttribute, $type) { try { $this->attrValidatorHelper->validateUnitFamilies($fromAttribute, $toAttribute); } catch (\LogicException $e) { throw InvalidArgumentException::expectedFromPreviousException($e, $fromAttribute->getCode() . ' && ' . $toAttribute->getCode(), 'copier', $type); } }
/** * Check locale and scope are valid * * @param AttributeInterface $attribute * @param string $locale * @param string $scope * @param string $type * * @throws \Pim\Bundle\CatalogBundle\Exception\InvalidArgumentException */ protected function checkLocaleAndScope(AttributeInterface $attribute, $locale, $scope, $type) { try { $this->attrValidatorHelper->validateLocale($attribute, $locale); $this->attrValidatorHelper->validateScope($attribute, $scope); } catch (\LogicException $e) { throw InvalidArgumentException::expectedFromPreviousException($e, $attribute->getCode(), 'copier', $type); } }