Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LockValidatorComposite.php
Go to the documentation of this file.
1 <?php
9 
11 {
15  protected $validators = [];
16 
22  public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $validators = [])
23  {
24  foreach ($validators as $validator) {
25  if (!is_subclass_of($validator, \Magento\Catalog\Model\Attribute\LockValidatorInterface::class)) {
26  throw new \InvalidArgumentException($validator . ' does not implements LockValidatorInterface');
27  }
28  $this->validators[] = $objectManager->get($validator);
29  }
30  }
31 
41  public function validate(\Magento\Framework\Model\AbstractModel $object, $attributeSet = null)
42  {
43  foreach ($this->validators as $validator) {
44  $validator->validate($object, $attributeSet);
45  }
46  }
47 }
validate(\Magento\Framework\Model\AbstractModel $object, $attributeSet=null)
is_subclass_of($obj, $className)
$objectManager
Definition: bootstrap.php:17
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $validators=[])