Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CED-1124 NGSTACK-831 edit infocollection #89

Open
wants to merge 89 commits into
base: 3.x
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
82983ad
CED-1124 WIP
Jan 11, 2024
a325b2c
CED-1124 WIP
Jan 11, 2024
1078320
CED-1124 enable information collection editing
Jan 12, 2024
0feeea3
CED-1124 use form theme from bundle
Jan 12, 2024
9837590
CED-1124 add configuration for EnhancedSelectionFieldHandler and fix …
Jan 12, 2024
b571290
CED-1124 remove dump from form.html.twig
Jan 12, 2024
8ae1fc8
CED-1124 Add minimal styling for ic edit form and translations for ed…
vjeran Jan 12, 2024
577d9e8
CED-1124 check edit permissions
Jan 15, 2024
3f85b70
CED-1124 add return type in createUpdateFormForLocation method
Jan 15, 2024
f9cf7a1
CED-1124 remove uneccessary comments
Jan 15, 2024
5ddfd75
CED-1124 set languages with config resolver
Jan 15, 2024
11c12af
CED-1124 add edit link on collection list
Jan 18, 2024
39638ea
CS Fixes
ludwig031 Jan 23, 2024
11079f5
CED-1124 add ibexa-forms-bundle package to composer.json
Feb 21, 2024
2dedd9f
CED-1124 refactor fromLegacyValue method
Feb 21, 2024
d44fc88
CED-1124 add fromLegacyValue method to interface
Feb 21, 2024
0b4f820
CED-1124 rename method fromLegacyValue to fromAttribute
Feb 21, 2024
2d33a49
CED-1124 use spritf when creating name for formbuilder
Feb 21, 2024
ac40a59
CED-1124 change the php version in composer.json
Feb 21, 2024
a5f8e50
CED-1124 fix code style and remove not necessary use statements in In…
Feb 21, 2024
0ff2402
CED-1124 require php 8.1 or greater
Feb 21, 2024
6fc74a5
CED-1124 InformationCollectionUpdateType.php code cleaning
Feb 23, 2024
1d67a7c
CED-1124 InformationCollectionUpdateMapper.php code cleaning
Feb 23, 2024
7faf13c
CED-1124 FormBuilder.php code cleaning
Feb 23, 2024
c34cdb5
CED-1124 code cleanup FormBuilder.php
Feb 23, 2024
251ce38
CED-1124 code cleanup AdminController.php
Feb 23, 2024
316673c
CED-1124 code cleanup field handlers
Feb 23, 2024
7182dd9
CED-1124 add findByCollectionIdAndFieldDefinitionId method to EzInfoC…
Feb 23, 2024
2f1bdff
CED-1024 rename variable in AdminController editAction
Feb 23, 2024
34ebdf2
CED-1024 add return value to CountryFieldHandler
Feb 23, 2024
4dc434f
CED-1124 typehint ValueObject instead of Value to make code more robust
Feb 27, 2024
d9710ed
CED-1124 use $this->createNotFoundException() in AdminController.php
Feb 27, 2024
36d5f6a
CED-1124 check if fielddefinition is null
Feb 27, 2024
2f9f33f
CED-1124 check if location is not null
Feb 27, 2024
58bc405
CED-1124 instead of type hinting ValueObject type hint Value Interface
Feb 27, 2024
e00a98d
CED-1124 rename method fromAttribute to getFieldValueFromAttribute
Feb 27, 2024
9d63353
CED-1124 use getFieldValueFromAttribute instead of fromAttribute
Feb 27, 2024
89702d5
CED-1124 typehint right InformationCollectionStruct
Mar 18, 2024
0c50e28
CED-1124 throw NotFoundException
Mar 18, 2024
1d3bd95
CED-1124 remove dependency on ibexa-forms-bundle
Mar 18, 2024
6f0f394
CED-1124 set right arguments
Mar 18, 2024
760b953
CED-1124 add form_fieldtype_handlers.yaml
Mar 18, 2024
1deef6b
CED-1124 add FieldTypeHandlerRegistryPass.php
Mar 18, 2024
852d03a
CED-1124 register FieldTypeHandlerRegistryPass.php
Mar 18, 2024
bdf85a9
CED-1124 adjustments to work with old FieldTypeHandler
Mar 19, 2024
d42fe13
CED-1124 clean up DataMapper.php
Mar 19, 2024
12dcfa7
CED-1124 clean up FieldTypeHandler.php
Mar 19, 2024
b540b6f
CED-1124 clean up Checkbox.php
Mar 19, 2024
691a39a
CED-1124 clean up Country.php
Mar 19, 2024
bba4273
CED-1124 clean up Selection.php
Mar 19, 2024
5a1554d
CED-1124 clean up FieldTypeHandlerInterface.php
Mar 19, 2024
65ef538
CED-1124 clean up field type handlers
Mar 19, 2024
932f303
CED-1124 remove User.php class
Mar 19, 2024
8aa2661
CED-1124 remove User from field type config
Mar 19, 2024
a0d2b5e
CED-1124 fix BinaryFile return type
Mar 19, 2024
83093de
CED-1124 sync parameter name with interface in mapDataToForms method
Mar 20, 2024
6580c58
CED-1124 sync parameter name with interface in mapFormsToData method
Mar 20, 2024
f574457
CED-1124 fix alias in Checkbox.php
Mar 20, 2024
75d831c
CED-1124 fix aliases and return types in field type handlers
Mar 20, 2024
fac3dfd
CED-1124 add docblock type hint to Country.php
Mar 20, 2024
e0905a8
CED-1124 match variable with interface Selection.php
Mar 20, 2024
df6111a
CED-1124 add docblock type hint to field type handler
Mar 20, 2024
6bec7a9
CED-1124 update code to PHP 8.1 standards
Mar 20, 2024
37edb6f
CED-1124 change name of variable in DataMapper.php
Mar 20, 2024
bc480a8
CED-1124 remove redundant inline type hint
Mar 20, 2024
90f8ad9
CED-1124 remove redundant inline type hint
Mar 20, 2024
54aa265
CED-1124 add return type to getCollectedValue method
Mar 20, 2024
cc986d9
CED-1124 add return type for value variable in setCollectedValue method
Mar 20, 2024
aec51eb
CED-1124 change alias in DateAndTime.php
Mar 20, 2024
a6d9a0e
CED-1124 fixed wrong variable name in DataMapper.php
Mar 20, 2024
1ab8f5d
CED-1124 remove UserType.php
Mar 20, 2024
7822313
CED-1124 remove UserUpdateType.php
Mar 20, 2024
bfce0ac
CED-1124 remove UserCreateType.php
Mar 20, 2024
6266154
CED-1124 add type hints to DataWrapper.php
Mar 20, 2024
4ccfd43
CED-1124 update docs in DataWrapper.php
Mar 20, 2024
706fed5
CED-1124 remove callable from parameter docs in FieldTypeHandlerRegis…
Mar 20, 2024
d2abeb6
CED-1124 type hint FieldTypeHandlerInterface in register method
Mar 20, 2024
38530c5
CED-1124 remove handling callable from get method in FieldTypeHandler…
Mar 20, 2024
49dc73c
CED-1124 move form types to Type folder
Mar 20, 2024
f52577d
CED-1124 adapt tag name for form_fieldtype_handlers.yaml
Mar 20, 2024
9f56103
CED-1124 adapt tag in FieldTypeHandlerRegistryPass.php
Mar 20, 2024
137ab03
CED-1124 add Birthday type
Mar 20, 2024
e46037b
CED-1124 remove FieldTypeHandlerInterface from Ibexa Forms bundle in …
Mar 20, 2024
9fb2e01
CED-1124 change class namespace in configuration
Mar 20, 2024
fc5f4d2
CED-1124 add enhanced selection handler
Mar 21, 2024
2c79357
CED-1124 standardize EnhancedSelection.php and Birthday.php with Fiel…
Mar 21, 2024
ffdd8eb
CED-1124 change input type and remove constraint in Birthday.php
Mar 21, 2024
8e9d616
CED-2116 Collection deletion bug fix
Dec 19, 2024
1f7fd08
Merge pull request #96 from netgen/CED-2116-collection-deletion-bug
emodric Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CED-1124 InformationCollectionUpdateMapper.php code cleaning
  • Loading branch information
Marijan Klaric committed Feb 23, 2024
commit 1d67a7cc9f4f0a8315150b198f35926c7f998418
18 changes: 10 additions & 8 deletions bundle/Form/DataMapper/InformationCollectionUpdateMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,38 @@

namespace Netgen\Bundle\InformationCollectionBundle\Form\DataMapper;

use eZ\Publish\API\Repository\Values\ContentType\ContentType;
use Netgen\Bundle\IbexaFormsBundle\Form\DataMapper;
use Netgen\Bundle\IbexaFormsBundle\Form\DataWrapper;
use Netgen\Bundle\IbexaFormsBundle\Form\Payload\InformationCollectionStruct;
use RuntimeException;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\PropertyAccess\PropertyPathInterface;

use function sprintf;

class InformationCollectionUpdateMapper extends DataMapper
{
protected function mapToForm(
FormInterface $form,
DataWrapper $data,
PropertyPathInterface $propertyPath
): void {
/** @var ContentType $contentType */
$contentType = $data->definition;
pspanja marked this conversation as resolved.
Show resolved Hide resolved

$fieldDefinitionIdentifier = (string) $propertyPath;
$fieldDefinition = $contentType->getFieldDefinition($fieldDefinitionIdentifier);

if (null === $fieldDefinition) {
throw new RuntimeException(
"Data definition does not contain expected FieldDefinition '{$fieldDefinitionIdentifier}'"
);
if ($fieldDefinition === null) {
throw new RuntimeException(sprintf('Data definition does not contain expected FieldDefinition %s', $fieldDefinitionIdentifier));
}

$fieldTypeIdentifier = $fieldDefinition->fieldTypeIdentifier;

$handler = $this->fieldTypeHandlerRegistry->get($fieldTypeIdentifier);

/** @var InformationCollectionStruct $struct */
$struct = $data->payload;
pspanja marked this conversation as resolved.
Show resolved Hide resolved

$collectedFieldValue = $struct->getCollectedFieldValue($fieldDefinitionIdentifier);
Expand All @@ -58,10 +62,8 @@ protected function mapFromForm(
$fieldDefinitionIdentifier = (string) $propertyPath;
$fieldDefinition = $contentType->getFieldDefinition($fieldDefinitionIdentifier);

if (null === $fieldDefinition) {
throw new RuntimeException(
"Data definition does not contain expected FieldDefinition '{$fieldDefinitionIdentifier}'"
);
if ($fieldDefinition === null) {
throw new RuntimeException(sprintf('Data definition does not contain expected FieldDefinition %s', $fieldDefinitionIdentifier));
}

$fieldTypeIdentifier = $fieldDefinition->fieldTypeIdentifier;
Expand Down