TASK: Fix smaller glitches
This commit is contained in:
parent
2094df147a
commit
08acce4619
4 changed files with 30 additions and 24 deletions
|
@ -28,8 +28,8 @@ use Workshop\ExampleExtension\Domain\Repository\AddressRepository;
|
||||||
class AddressController extends ActionController
|
class AddressController extends ActionController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var AddressRepository
|
* @var AddressRepository
|
||||||
*/
|
*/
|
||||||
protected $addressRepository;
|
protected $addressRepository;
|
||||||
|
|
||||||
public function __construct(AddressRepository $addressRepository)
|
public function __construct(AddressRepository $addressRepository)
|
||||||
|
|
|
@ -9,23 +9,27 @@
|
||||||
4: 'city',
|
4: 'city',
|
||||||
5: 'country'
|
5: 'country'
|
||||||
}" as="propertyName">
|
}" as="propertyName">
|
||||||
<p>
|
{f:render(section: 'Field', arguments: {
|
||||||
<label for="{propertyName}">
|
propertyName: propertyName
|
||||||
{f:translate(id: 'labels.{propertyName}')}
|
})}
|
||||||
</label>
|
|
||||||
<br>
|
|
||||||
<f:form.textfield property="{propertyName}" id="{propertyName}" />
|
|
||||||
{f:render(section: 'FieldErrors', arguments: {
|
|
||||||
propertyPath: 'address.{propertyName}'
|
|
||||||
})}
|
|
||||||
<br>
|
|
||||||
</p>
|
|
||||||
</f:for>
|
</f:for>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<f:form.submit value="Update" />
|
<f:form.submit value="Update" />
|
||||||
</f:form>
|
</f:form>
|
||||||
|
|
||||||
|
<f:section name="Field">
|
||||||
|
<p>
|
||||||
|
<label for="{propertyName}">{f:translate(id: 'labels.{propertyName}')}</label>
|
||||||
|
<br>
|
||||||
|
<f:form.textfield property="{propertyName}" id="{propertyName}" />
|
||||||
|
{f:render(section: 'FieldErrors', arguments: {
|
||||||
|
propertyPath: 'address.{propertyName}'
|
||||||
|
})}
|
||||||
|
<br>
|
||||||
|
</p>
|
||||||
|
</f:section>
|
||||||
|
|
||||||
<f:section name="FieldErrors">
|
<f:section name="FieldErrors">
|
||||||
<f:form.validationResults for="{propertyPath}">
|
<f:form.validationResults for="{propertyPath}">
|
||||||
<f:for each="{validationResults.flattenedErrors}" as="errors">
|
<f:for each="{validationResults.flattenedErrors}" as="errors">
|
||||||
|
|
|
@ -106,7 +106,6 @@ Before v9, the file would look like:
|
||||||
KEY parent (pid)
|
KEY parent (pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Model
|
Model
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@ -125,7 +124,7 @@ Each model is a PHP class structure like:
|
||||||
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/Classes/Domain/Model/Address.php
|
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/Classes/Domain/Model/Address.php
|
||||||
:language: php
|
:language: php
|
||||||
:linenos:
|
:linenos:
|
||||||
:lines: 1-4,24-32,63-66,87
|
:lines: 1-4,24-29,31-32,64-68,119
|
||||||
|
|
||||||
Repository
|
Repository
|
||||||
----------
|
----------
|
||||||
|
@ -178,7 +177,7 @@ to the view:
|
||||||
:lines: 28-29,40-43,66
|
:lines: 28-29,40-43,66
|
||||||
|
|
||||||
The ``AddressRepository`` extends the base ``Repository`` class and inherits some
|
The ``AddressRepository`` extends the base ``Repository`` class and inherits some
|
||||||
methods, e.g. ``findAll``.
|
methods, e.g. ``findAll()``.
|
||||||
|
|
||||||
Template
|
Template
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -9,16 +9,16 @@ only need :file:`ext_tables.sql` the TCA and TypoScript for rendering.
|
||||||
Extbase is needed if you provide interaction to the user, e.g. updating or adding
|
Extbase is needed if you provide interaction to the user, e.g. updating or adding
|
||||||
records.
|
records.
|
||||||
|
|
||||||
Even that can nowadays achieved using the system extension "Form". Still we will
|
Even that can nowadays be achieved using the system extension "Form". Still we will
|
||||||
cover how to update a record next.
|
cover how to update a record next.
|
||||||
|
|
||||||
We need a form where we can adjust the values of the record, e.g. change the
|
We need a form where we can adjust the values of the record, e.g. change the
|
||||||
companies name.
|
company name.
|
||||||
|
|
||||||
Therefore we will add a new ``editAction()``. This will receive a single ``Address``
|
Therefore we will add a new ``editAction()``. This will receive a single ``Address``
|
||||||
for editing and provides the form. We also will add an ``updateAction()`` which
|
for editing and provides the form. We also add an ``updateAction()`` which receives a
|
||||||
receives a single ``Address``. This action is the target of the submit form and will
|
single ``Address``. This action is the target of the submit form and will update the
|
||||||
update the database record.
|
database record.
|
||||||
|
|
||||||
To start editing an address, we will add an link from :file:`index.html` to
|
To start editing an address, we will add an link from :file:`index.html` to
|
||||||
``editAction()``.
|
``editAction()``.
|
||||||
|
@ -50,7 +50,7 @@ Creating Forms
|
||||||
Create a form which will show the current values of a single ``Address`` to the
|
Create a form which will show the current values of a single ``Address`` to the
|
||||||
user.
|
user.
|
||||||
|
|
||||||
TYPO3 also provides ViewHelpers to create forms. Of course you could create form with
|
TYPO3 also provides ViewHelpers to create forms. Of course you could create forms with
|
||||||
pure HTML, but TYPO3 / Fluid adds some security aspects and makes things easier.
|
pure HTML, but TYPO3 / Fluid adds some security aspects and makes things easier.
|
||||||
|
|
||||||
E.g. a proper validation that forms were not manipulated are added out of the box.
|
E.g. a proper validation that forms were not manipulated are added out of the box.
|
||||||
|
@ -229,6 +229,8 @@ Germany. One or more leading 0 are allowed, we therefore will not use the PHP ty
|
||||||
*/
|
*/
|
||||||
protected $zip;
|
protected $zip;
|
||||||
|
|
||||||
|
Also see: https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.3/Feature-83167-ReplaceValidateWithTYPO3CMSExtbaseAnnotationValidate.html
|
||||||
|
|
||||||
Display validation errors
|
Display validation errors
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
@ -274,9 +276,10 @@ Handling existing invalid records
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
In some circumstances your system might have an invalid record. Right now it's not
|
In some circumstances your system might have an invalid record. Right now it's not
|
||||||
possible to edit this record with `editAction` as Extbase will validate the record.
|
possible to edit this record with ``editAction()`` as Extbase will validate the
|
||||||
|
record.
|
||||||
|
|
||||||
Therefore the `@ignorevalidation` annotation can be added to the action::
|
Therefore the ``@ignorevalidation`` annotation can be added to the action::
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignorevalidation $address
|
* @ignorevalidation $address
|
||||||
|
|
Loading…
Reference in a new issue