99use Atk4 \Core \InitializerTrait ;
1010use Atk4 \Core \TrackableTrait ;
1111use Atk4 \Data \Exception ;
12- use Atk4 \Data \Field ;
1312use Atk4 \Data \Model ;
1413
1514/**
@@ -119,46 +118,6 @@ public function getActionForEntity(Model $entity): self
119118 throw new Exception ('Action instance not found in model ' );
120119 }
121120
122- /**
123- * @param mixed $value
124- *
125- * @return mixed
126- */
127- protected function normalizeArg (string $ name , $ value )
128- {
129- $ argFieldSeed = $ this ->args [$ name ];
130- if ($ argFieldSeed instanceof Model) {
131- return $ value === null
132- ? null
133- : $ argFieldSeed ::assertInstanceOf ($ value );
134- }
135-
136- $ argField = new Field ($ argFieldSeed );
137-
138- return $ argField ->normalize ($ value );
139- }
140-
141- /**
142- * @param array<int|string, mixed> $args
143- *
144- * @return array<string, mixed>
145- */
146- protected function normalizeArgs ($ args ): array
147- {
148- $ argsNames = array_keys ($ this ->args );
149-
150- $ res = [];
151- foreach ($ args as $ k => $ v ) {
152- if (is_int ($ k )) {
153- $ k = $ argsNames [$ k ];
154- }
155-
156- $ res [$ k ] = $ this ->normalizeArg ($ k , $ v );
157- }
158-
159- return $ res ;
160- }
161-
162121 /**
163122 * Attempt to execute callback of the action.
164123 *
@@ -183,7 +142,6 @@ public function execute(...$args)
183142 try {
184143 $ this ->validateBeforeExecute ();
185144
186- $ args = $ this ->normalizeArgs ($ args );
187145 if ($ passOwner ) {
188146 array_unshift ($ args , $ this ->_getOwner ());
189147 }
@@ -257,7 +215,6 @@ public function preview(...$args)
257215 try {
258216 $ this ->validateBeforeExecute ();
259217
260- $ args = $ this ->normalizeArgs ($ args );
261218 if ($ passOwner ) {
262219 array_unshift ($ args , $ this ->_getOwner ());
263220 }
0 commit comments