20
20
/**
21
21
* Default implementation of {@link PropertyAccessorInterface}.
22
22
*
23
+ * Be sure to enable Doctrine Cache to improve performance of the accessor.
24
+ *
23
25
* @author Bernhard Schussek <bschussek@gmail.com>
24
26
* @author Kévin Dunglas <dunglas@gmail.com>
25
27
*/
@@ -57,16 +59,6 @@ class PropertyAccessor implements PropertyAccessorInterface
57
59
*/
58
60
private $ cache ;
59
61
60
- /**
61
- * @var array
62
- */
63
- private $ readPropertyCache = array ();
64
-
65
- /**
66
- * @var array
67
- */
68
- private $ writePropertyCache = array ();
69
-
70
62
/**
71
63
* Should not be used by application code. Use
72
64
* {@link PropertyAccess::createPropertyAccessor()} instead.
@@ -408,9 +400,7 @@ private function getReadAccessInfo($object, $property)
408
400
{
409
401
$ key = get_class ($ object ).':: ' .$ property ;
410
402
411
- if (isset ($ this ->readPropertyCache [$ key ])) {
412
- $ access = $ this ->readPropertyCache [$ key ];
413
- } elseif (!$ this ->cache || false === $ access = $ this ->cache ->fetch (self ::CACHE_PREFIX_READ .$ key )) {
403
+ if (!$ this ->cache || false === $ access = $ this ->cache ->fetch (self ::CACHE_PREFIX_READ .$ key )) {
414
404
$ access = array ();
415
405
416
406
$ reflClass = new \ReflectionClass ($ object );
@@ -468,8 +458,6 @@ private function getReadAccessInfo($object, $property)
468
458
if ($ this ->cache ) {
469
459
$ this ->cache ->save (self ::CACHE_PREFIX_READ .$ key , $ access );
470
460
}
471
-
472
- $ this ->readPropertyCache [$ key ] = $ access ;
473
461
}
474
462
475
463
return $ access ;
@@ -594,9 +582,7 @@ private function getWriteAccessInfo($object, $property, $value)
594
582
$ key = get_class ($ object ).':: ' .$ property ;
595
583
$ guessedAdders = '' ;
596
584
597
- if (isset ($ this ->writePropertyCache [$ key ])) {
598
- $ access = $ this ->writePropertyCache [$ key ];
599
- } elseif (!$ this ->cache || false === $ access = $ this ->cache ->fetch (self ::CACHE_PREFIX_WRITE .$ key )) {
585
+ if (!$ this ->cache || false === $ access = $ this ->cache ->fetch (self ::CACHE_PREFIX_WRITE .$ key )) {
600
586
$ access = array ();
601
587
602
588
$ reflClass = new \ReflectionClass ($ object );
@@ -661,8 +647,6 @@ private function getWriteAccessInfo($object, $property, $value)
661
647
if ($ this ->cache ) {
662
648
$ this ->cache ->save (self ::CACHE_PREFIX_WRITE .$ key , $ access );
663
649
}
664
-
665
- $ this ->writePropertyCache [$ key ] = $ access ;
666
650
}
667
651
668
652
return $ access ;
0 commit comments