FLOW3 provides a convenient way to pass entities by ID in the URL, and get them automatically instantiated in the controller action's parameters:
class PostController extends \TYPO3\FLOW3\MVC\Controller\ActionController {
public function editAction(Post $post) {
...
}
}
But what about the use case where you have checkboxes, each representing a particular object? It would be handy to get them autoinstantiated as well:
<input type="checkbox" name="tags[]" value="1" />
<input type="checkbox" name="tags[]" value="2" />
...
Is there a way to tell FLOW3 to auto-instantiate the $tags
variable as an array of Tag
objects? Something like:
public function setTagsAction(Post $post, /** @var Model\Tag */ array $tags) {
$post->setTags($tags);
}
<input type="checkbox" name="tags[][__identity]" value="1" />
(at least in extbase this should be possible) – ImpatiencePost
hasManyTag
, right? So you don't need to set a new parameter, all you need to do is to send and get tags asPost
's children. Note: there is a trick thing you MUST to do atinitializeMyActionNameAction
. Are you using Flow 2.0 (they just released 2.1 today) and FLUID? I can post a complete answer. – Beelzebub