1212namespace Symfony \Component \PropertyAccess ;
1313
1414use Psr \Cache \CacheItemPoolInterface ;
15+ use Symfony \Component \PropertyInfo \PropertyReadInfoExtractorInterface ;
16+ use Symfony \Component \PropertyInfo \PropertyWriteInfoExtractorInterface ;
1517
1618/**
1719 * A configurable builder to create a PropertyAccessor.
@@ -29,6 +31,16 @@ class PropertyAccessorBuilder
2931 */
3032 private $ cacheItemPool ;
3133
34+ /**
35+ * @var PropertyReadInfoExtractorInterface|null
36+ */
37+ private $ readInfoExtractor ;
38+
39+ /**
40+ * @var PropertyWriteInfoExtractorInterface|null
41+ */
42+ private $ writeInfoExtractor ;
43+
3244 /**
3345 * Enables the use of "__call" by the PropertyAccessor.
3446 *
@@ -157,13 +169,43 @@ public function getCacheItemPool()
157169 return $ this ->cacheItemPool ;
158170 }
159171
172+ /**
173+ * @return $this
174+ */
175+ public function setReadInfoExtractor (?PropertyReadInfoExtractorInterface $ readInfoExtractor )
176+ {
177+ $ this ->readInfoExtractor = $ readInfoExtractor ;
178+
179+ return $ this ;
180+ }
181+
182+ public function getReadInfoExtractor (): ?PropertyReadInfoExtractorInterface
183+ {
184+ return $ this ->readInfoExtractor ;
185+ }
186+
187+ /**
188+ * @return $this
189+ */
190+ public function setWriteInfoExtractor (?PropertyWriteInfoExtractorInterface $ writeInfoExtractor )
191+ {
192+ $ this ->writeInfoExtractor = $ writeInfoExtractor ;
193+
194+ return $ this ;
195+ }
196+
197+ public function getWriteInfoExtractor (): ?PropertyWriteInfoExtractorInterface
198+ {
199+ return $ this ->writeInfoExtractor ;
200+ }
201+
160202 /**
161203 * Builds and returns a new PropertyAccessor object.
162204 *
163205 * @return PropertyAccessorInterface The built PropertyAccessor
164206 */
165207 public function getPropertyAccessor ()
166208 {
167- return new PropertyAccessor ($ this ->magicCall , $ this ->throwExceptionOnInvalidIndex , $ this ->cacheItemPool , $ this ->throwExceptionOnInvalidPropertyPath );
209+ return new PropertyAccessor ($ this ->magicCall , $ this ->throwExceptionOnInvalidIndex , $ this ->cacheItemPool , $ this ->throwExceptionOnInvalidPropertyPath , $ this -> readInfoExtractor , $ this -> writeInfoExtractor );
168210 }
169211}
0 commit comments