@@ -19,7 +19,10 @@ abstract class AbstractValidator
19
19
{
20
20
use ExtensionIdTrait;
21
21
22
- public static string $ CORE_VALIDATION_CACHE_KEY = 'core.validation.extension_id_class_names ' ;
22
+ /**
23
+ * @var string
24
+ */
25
+ public static $ CORE_VALIDATION_CACHE_KEY = 'core.validation.extension_id_class_names ' ;
23
26
24
27
/**
25
28
* @var array
@@ -46,20 +49,14 @@ public function addConfiguration($callable)
46
49
*/
47
50
protected $ translator ;
48
51
49
- /**
50
- * @var Cache
51
- */
52
- protected $ cache ;
53
-
54
52
/**
55
53
* @param Factory $validator
56
54
* @param TranslatorInterface $translator
57
55
*/
58
- public function __construct (Factory $ validator , TranslatorInterface $ translator, Cache $ cache )
56
+ public function __construct (Factory $ validator , TranslatorInterface $ translator )
59
57
{
60
58
$ this ->validator = $ validator ;
61
59
$ this ->translator = $ translator ;
62
- $ this ->cache = $ cache ;
63
60
}
64
61
65
62
/**
@@ -97,8 +94,10 @@ protected function getMessages()
97
94
*/
98
95
protected function getAttributeNames ()
99
96
{
100
- if ($ this ->cache ->get (self ::$ CORE_VALIDATION_CACHE_KEY ) !== null ) {
101
- return $ this ->cache ->get (self ::$ CORE_VALIDATION_CACHE_KEY );
97
+ $ cache = resolve (Cache::class);
98
+
99
+ if ($ cache ->get (self ::$ CORE_VALIDATION_CACHE_KEY ) !== null ) {
100
+ return $ cache ->get (self ::$ CORE_VALIDATION_CACHE_KEY );
102
101
}
103
102
104
103
$ extId = $ this ->getClassExtensionId ();
@@ -109,7 +108,7 @@ protected function getAttributeNames()
109
108
$ attributeNames [$ attribute ] = $ this ->translator ->trans ($ key );
110
109
}
111
110
112
- $ this -> cache ->forever (self ::$ CORE_VALIDATION_CACHE_KEY , $ attributeNames );
111
+ $ cache ->forever (self ::$ CORE_VALIDATION_CACHE_KEY , $ attributeNames );
113
112
114
113
return $ attributeNames ;
115
114
}
0 commit comments