sonata-project / SonataArticleBundle

[Abandoned] Advanced article management
https://docs.sonata-project.org/projects/SonataArticleBundle
MIT License
11 stars 25 forks source link

Back Office Title should contain the empty_data option #283

Closed srascar closed 3 years ago

srascar commented 3 years ago

The declaration of the backofficeTitle field should include the empty_data option. If not, this conflicts with the entity type declaration.

ex:

$formMapper->add('backofficeTitle', TextType::class, [
    'empty_data' => ''
]);

 Expected

Actual

Expected argument of type "string", "null" given at property path "backofficeTitle".

https://github.com/sonata-project/SonataArticleBundle/blob/bfcb250f097b9f4a3971a9a23bb04ba6fe6fdb65/src/FragmentService/AbstractFragmentService.php#L49

VincentLanglet commented 3 years ago

Shouldn't the field be required ?

srascar commented 3 years ago

The field is required but this check is made by validators. That means the entity property is set before and that raises an exception in the property accessor

VincentLanglet commented 3 years ago

Do you mind making the PR ?

srascar commented 3 years ago

https://github.com/sonata-project/SonataArticleBundle/pull/284