Conversation
* 3.97 * Update CHANGELOG.md Co-authored-by: Javier Spagnoletti <phansys@gmail.com> * Upgrade note Co-authored-by: Javier Spagnoletti <phansys@gmail.com>
Instead of passing `breadcrumbs_builder` parameter to all templates, it uses `render_breadcrumbs` and `render_breadcrumbs_for_title` twig functions. For keeping BC, these functions accept the breadcrumbs builder as last argument.
| * type?: string, | ||
| * virtual_field?: bool | ||
| * }&array<string, mixed>|array<empty, empty> | ||
| * }|array<empty, empty> |
There was a problem hiding this comment.
I don't know if it's de proper fix, but phpstan does not complain
There was a problem hiding this comment.
This is not valid IMHO, and we'll get some others errors.
Any option should be valid.
For instance, in my code, I'm using
->add('clients', null, [
'template' => 'admin/sonata/list/contract_clients.html.twig',
'link' => 'admin_assurancevie_client_edit',
])
There was a problem hiding this comment.
Maybe the issue should be reported to phpstan
| * type?: string, | ||
| * virtual_field?: bool | ||
| * }&array<string, mixed>|array<empty, empty> | ||
| * }|array<empty, empty> |
There was a problem hiding this comment.
This is not valid IMHO, and we'll get some others errors.
Any option should be valid.
For instance, in my code, I'm using
->add('clients', null, [
'template' => 'admin/sonata/list/contract_clients.html.twig',
'link' => 'admin_assurancevie_client_edit',
])
|
Why any option should be valid? I think we should restrict the options, otherwise (as it's happening now) it is impossible to control, in fact there was a starting PR to fix this: #6078 |
I think this is not a good idea. In fact, I think we should remove this custom type and prefer Restricting the option in the interface FieldDescriptionInterface, it's like restricting the option in the FormTypeInterface. For instance the |
IMO that would be a mistake.
I think it's quite different, by general, there is only one or two implementations (one per persistence bundle) of The options, as stated in the code, are dependent of the type of the context. Something I had in mind since a long time (I think I wrote about it somewhere) is to create classes for the
For passing values to the template there should be an option for that, to use options that way it's just a hack and I think there is no documentation about that. But as this is going nowhere, best if @sonata-project/contributors decide. |
Yes, but someone could use his own persistence or his own FieldDescription with more features (and options).
Some options are specific to only some FieldDescription type ; for instance or which only related to the another example
I'm sure I can find others options used for specific FieldDescription types.
I just follow the way we're doing for all the existing templates. |
tests/Admin/AdminTest.php
Outdated
| $perPageOptions = $admin->getPerPageOptions(); | ||
|
|
||
| $this->assertSame([10, 25, 50, 100, 250], $perPageOptions); | ||
| $this->assertSame([16, 32, 64, 128, 256], $perPageOptions); |
There was a problem hiding this comment.
We should update the two constants of the AbstractAdmin instead of the tests.
This was the values of our persistent bundle
https://github.com/sonata-project/SonataDoctrineMongoDBAdminBundle/blob/c18eb59881d7ebd7aeca92de9bf9e74c0e812090/src/Model/ModelManager.php#L613
https://github.com/sonata-project/SonataDoctrineMongoDBAdminBundle/blob/c18eb59881d7ebd7aeca92de9bf9e74c0e812090/src/Model/ModelManager.php#L629
There was a problem hiding this comment.
The constants are private.
The values of those method were never used because are overridden in
SonataAdminBundle/src/Admin/AbstractAdmin.php
Lines 700 to 709 in a8731dc
There was a problem hiding this comment.
The values of those method were never used because are overridden in
SonataAdminBundle/src/Admin/AbstractAdmin.php
Lines 700 to 709 in a8731dc
I remember that in some issue "business" values were preferred over "binary" values.
They were meant to be used, that's why it was fixed in the master branch in the same time that the deprecation of getDefaultSortValues.
Currently the values in master are [10, 25, 50, 100, 250], the introduction of a constant to not use "magic numbers" shouldn't change the values.
There was a problem hiding this comment.
Well, to be fair, in master tests were changed here, but I don't find any comment about that:
0353882#diff-988f567ac1553662391a6e5079ce038f8f58cf2f1e7aafba378ce38eb2b9aaecR718-R728
There was a problem hiding this comment.
Comments were added in the AbstractAdmin https://github.com/sonata-project/SonataAdminBundle/pull/7102/files#diff-0850515af24b81ce716f53b8eb0b71fae91dcbdcc88b28d95a83886504e1c8f4R2660-R2663 and maybe the comment were missing in the test, but there was updated accordingly to the value change in the AbstractAdmin.
This is why I posted #7102 (comment)
To add a NEXT_MAJOR comment here: #7102 (comment)
private const DEFAULT_LIST_PER_PAGE_RESULTS = 32; // NEXT_MAJOR: Change to 25
private const DEFAULT_LIST_PER_PAGE_OPTIONS = [16, 32, 64, 128, 256]; // NEXT_MAJOR: Change to [10, 25, 50, 100, 250]
I thought you said you'll modify them https://github.com/sonata-project/SonataAdminBundle/pull/7102/files#issuecomment-824092510
|
@franmomu This seems to be the way to fix the type https://phpstan.org/r/e3aa9a0c-66d3-4e80-a3a3-882d13fc14fc
|
No description provided.