@@ -29,13 +29,8 @@ trait BuilderTrait
2929 */
3030 public function fill (array $ properties ): void
3131 {
32- foreach ($ properties as $ key ) {
33- if (property_exists ($ this , $ key )) {
34- // This is like setProperty() but without in_array() checks on fillable
35- ($ str = $ this ->checkForSetMutator ($ key ))
36- ? $ this ->{$ str }($ properties [$ key ])
37- : $ this ->{$ key } = $ properties [$ key ];
38- }
32+ foreach ($ properties as $ key => $ value ) {
33+ $ this ->setProperty ($ key , $ value );
3934 }
4035 }
4136
@@ -89,14 +84,6 @@ protected function checkForSetMutator(string $key)
8984 */
9085 protected function getProperty (string $ key )
9186 {
92- if (isset ($ this ->repositories [$ key ])) {
93- if (! isset ($ this ->repositories_cache [$ key ])) {
94- $ this ->repositories_cache [$ key ] = $ this ->factory ->create ($ this ->repositories [$ key ], $ this ->getRepositoryProperties ());
95- }
96-
97- return $ this ->repositories_cache [$ key ];
98- }
99-
10087 if ($ str = $ this ->checkForGetMutator ($ key )) {
10188 return $ this ->{$ str }();
10289 }
@@ -122,7 +109,7 @@ protected function setProperty(string $key, $value): void
122109 return ;
123110 }
124111
125- if (in_array ( $ key , $ this -> fillable )) {
112+ if (property_exists ( $ this , $ key )) {
126113 $ this ->{$ key } = $ value ;
127114 }
128115 }
0 commit comments