diff --git a/README.md b/README.md index bb13bd8..68d9015 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,21 @@ Install the latest version with $ composer require omasn/object-handler ``` +### Symfony Configuring + +``` +services: + _instanceof: + Omasn\ObjectHandler\HandleTypeInterface: + tags: [ 'omasn.objectHandlerType' ] + + Omasn\ObjectHandler\ObjectHandlerInterface: + class: Omasn\ObjectHandler\ObjectHandler + autowire: true + bind: + $handleTypes: !tagged_iterator omasn.objectHandlerType +``` + ## Basic Usage ```php diff --git a/src/ObjectHandler.php b/src/ObjectHandler.php index cde1cf6..4bb7553 100644 --- a/src/ObjectHandler.php +++ b/src/ObjectHandler.php @@ -30,7 +30,7 @@ final class ObjectHandler extends AbstractHandler /** * @var HandleTypeInterface[] */ - protected array $handleTypes = []; + protected iterable $handleTypes = []; private PropertyInfoExtractorInterface $propertyInfoExtractor; private PropertyAccessorInterface $propertyAccessor; @@ -40,7 +40,7 @@ final class ObjectHandler extends AbstractHandler * @param HandleTypeInterface[]|callable[] $handleTypes */ public function __construct( - array $handleTypes, + iterable $handleTypes, PropertyInfoExtractorInterface $propertyInfoExtractor, PropertyAccessorInterface $propertyAccessor = null, ViolationFactoryInterface $violationFactory = null