-
-
Notifications
You must be signed in to change notification settings - Fork 342
Fix phpstan and bump Psalm #1421
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
83ca012
3.33 (#1422)
VincentLanglet 461c588
documentation for custom DataSource (#1423)
virtualize 7493cff
DevKit updates (#1426)
SonataCI 46f0c1e
Fix psalm lvl 6
VincentLanglet 5be6c3d
Bump psalm level 4
VincentLanglet 69bd1d4
Wip fix phpstan/psalm
VincentLanglet 101cb30
Fix lint
VincentLanglet 61a25af
Fix tests
VincentLanglet 29f91c8
Bump doctrine
VincentLanglet 301560e
Add conflict
VincentLanglet 4646a5e
Fix phpstan/psalm
VincentLanglet e9a48aa
Use FilterData
franmomu 100b694
Fix phpstan
VincentLanglet cfcce03
Fix phpstan issue
VincentLanglet 010a32a
Stop using SonataAdmin config in doctrineORMAdmin (#1427)
VincentLanglet 8f29771
Add forward compatibility with FilterData
franmomu 7df241b
Add functional test for simple pager
franmomu ae31060
Use Paginator for ProxyQuery
VincentLanglet 4555002
Use `execute` method directly in the pager
VincentLanglet 1c7228d
Merge branch '3.x' into psalm
VincentLanglet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| .. index:: | ||
| double: Reference; Export / DataSource | ||
|
|
||
| Export / DataSource | ||
| =================== | ||
|
|
||
| When using an admins export feature you might want to modify how dates and times are exported. | ||
| This is done by calling ``setDateTimeFormat`` on the data source iterator. | ||
|
|
||
| Here's one way to do it: | ||
|
|
||
| 1. Decorate the default Sonata\DoctrineORMAdminBundle\Exporter\DataSource with your own and call ``setDateTimeFormat`` there.:: | ||
|
|
||
| <?php | ||
|
|
||
| namespace App\Service\Admin; | ||
|
|
||
| use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; | ||
| use Sonata\AdminBundle\Exporter\DataSourceInterface; | ||
| use Sonata\DoctrineORMAdminBundle\Exporter\DataSource; | ||
| use Sonata\Exporter\Source\DoctrineORMQuerySourceIterator; | ||
| use Sonata\Exporter\Source\SourceIteratorInterface; | ||
|
|
||
| class DecoratingDataSource implements DataSourceInterface | ||
| { | ||
| private DataSource $dataSource; | ||
|
|
||
| public function __construct(DataSource $dataSource) | ||
| { | ||
| $this->dataSource = $dataSource; | ||
| } | ||
|
|
||
| public function createIterator(ProxyQueryInterface $query, array $fields): SourceIteratorInterface | ||
| { | ||
| /** @var DoctrineORMQuerySourceIterator $iterator */ | ||
| $iterator = $this->dataSource->createIterator($query, $fields); | ||
|
|
||
| $iterator->setDateTimeFormat('Y-m-d H:i:s'); | ||
|
|
||
| return $iterator; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| 2. Add the your service in the ``config/services.yaml`` definition.:: | ||
|
|
||
| services: | ||
| ... | ||
| App\Service\Admin\DecoratingDataSource: | ||
| decorates: 'sonata.admin.data_source.orm' | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <files psalm-version="3.16@d03e5ef057d6adc656c0ff7e166c50b73b4f48f3"> | ||
| <file src="src/Builder/FormContractor.php"> | ||
| <UndefinedClass occurrences="1"> | ||
| <code>[CollectionType::class, 'Sonata\CoreBundle\Form\Type\CollectionType']</code> | ||
| </UndefinedClass> | ||
| <!-- https://github.com/vimeo/psalm/issues/5643 --> | ||
| <file src="src/Model/ModelManager.php"> | ||
| <TypeDoesNotContainType occurrences="1"> | ||
| <code>[] === $idx</code> | ||
| </TypeDoesNotContainType> | ||
| </file> | ||
| <!-- https://github.com/vimeo/psalm/issues/5551 --> | ||
| <file src="tests/Filter/FilterTest.php"> | ||
| <UndefinedPropertyFetch occurrences="1"> | ||
| <code>static::$groupedOrExpressions</code> | ||
| </UndefinedPropertyFetch> | ||
| <UndefinedPropertyAssignment occurrences="1"> | ||
| <code>static::$groupedOrExpressions</code> | ||
| </UndefinedPropertyAssignment> | ||
| </file> | ||
| </files> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you will also need to conflict with previous alphas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"sonata-project/admin-bundle": "<=4.0.0-alpha-1" ?