12
12
namespace Symfony \Component \PropertyAccess ;
13
13
14
14
use Psr \Cache \CacheItemPoolInterface ;
15
+ use Symfony \Component \PropertyInfo \PropertyReadInfoExtractorInterface ;
16
+ use Symfony \Component \PropertyInfo \PropertyWriteInfoExtractorInterface ;
15
17
16
18
/**
17
19
* A configurable builder to create a PropertyAccessor.
@@ -29,6 +31,16 @@ class PropertyAccessorBuilder
29
31
*/
30
32
private $ cacheItemPool ;
31
33
34
+ /**
35
+ * @var PropertyReadInfoExtractorInterface|null
36
+ */
37
+ private $ readInfoExtractor ;
38
+
39
+ /**
40
+ * @var PropertyWriteInfoExtractorInterface|null
41
+ */
42
+ private $ writeInfoExtractor ;
43
+
32
44
/**
33
45
* Enables the use of "__call" by the PropertyAccessor.
34
46
*
@@ -157,13 +169,43 @@ public function getCacheItemPool()
157
169
return $ this ->cacheItemPool ;
158
170
}
159
171
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
+
160
202
/**
161
203
* Builds and returns a new PropertyAccessor object.
162
204
*
163
205
* @return PropertyAccessorInterface The built PropertyAccessor
164
206
*/
165
207
public function getPropertyAccessor ()
166
208
{
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 );
168
210
}
169
211
}
0 commit comments