[Flow] TYPO3 Flow for a new project?
Bastian Waidelich
bastian at typo3.org
Wed Jul 2 14:03:03 CEST 2014
Roberto Torresani wrote:
Hi Roberto,
I forgot to respond it seems.. Did you get around the problem in the
meantime?
> I read the page you sent me, but it's not exactly what I need.
> I have a model User with userdata. I want, for example, edit/update in one
> page phones, email and status of all users from Italy.
That are two challenges here:
* You need a way to filter your users based on some input (e.g.
country=italiy)
* You need to be able to batch-process a collection of users
For the filter I'd suggest to introduce a "demand" DTO, s.th. like this:
class UserFilter {
protected $country;
// ...
}
class UserController {
public function indexAction(UserFilter $filter) {
$users = $this->userRepository->findByFilter($filter);
}
}
This is a very extensible way and you can re-assign the filter to the
view in order to populate the <f:form.* /> ViewHelpers properly:
<f:form action="index" method="get" object="{filter}" objectName="filter">
<f:form.textfield property="country" />
<!-- ... -->
</f:form>
For the second challenge (batch-processing) I think the link at least
points in the right direction: Just create a "batch" DTO that contains a
collection of users.. The corresponding Fluid template might look like:
<f:form action="batchprocess" object="{users}" objectName="users">
<f:for each="{filteredUsers}" as="user" iteration="iteration">
<f:form.checkbox property="users.{iteration.index}" value="{user}" />
</f:for>
<!-- ... -->
</f:form>
(all untested)
HTH,
--
Bastian Waidelich
More information about the Flow
mailing list