Add data providers and data persisters matches to the debug panel#2262
Add data providers and data persisters matches to the debug panel#2262dunglas merged 7 commits intoapi-platform:masterfrom
Conversation
71f5437 to
5bbeb47
Compare
|
Very good idea! |
| /** | ||
| * @author Anthony GRASSIOT <antograssiot@free.fr> | ||
| */ | ||
| class TraceableChainDataPersister implements DataPersisterInterface |
There was a problem hiding this comment.
| class TraceableChainDataPersister implements DataPersisterInterface | |
| final class TraceableChainDataPersister implements DataPersisterInterface |
| { | ||
| if ($dataPersister instanceof ChainDataPersister) { | ||
| $this->decorated = $dataPersister; | ||
| $reflection = new \ReflectionProperty(ChainDataPersister::class, 'persisters'); |
There was a problem hiding this comment.
Maybe can you make this parameter public and marked @internal?
src/Bridge/Symfony/Bundle/DataPersister/TraceableChainDataPersister.php
Outdated
Show resolved
Hide resolved
src/Bridge/Symfony/Bundle/DataPersister/TraceableChainDataPersister.php
Outdated
Show resolved
Hide resolved
| public function __construct(CollectionDataProviderInterface $collectionDataProvider) | ||
| { | ||
| if ($collectionDataProvider instanceof ChainCollectionDataProvider) { | ||
| $reflection = new \ReflectionProperty(ChainCollectionDataProvider::class, 'dataProviders'); |
src/Bridge/Symfony/Bundle/DataProvider/TraceableChainItemDataProvider.php
Show resolved
Hide resolved
src/Bridge/Symfony/Bundle/DataProvider/TraceableChainItemDataProvider.php
Outdated
Show resolved
Hide resolved
| public function __construct(SubresourceDataProviderInterface $subresourceDataProvider) | ||
| { | ||
| if ($subresourceDataProvider instanceof ChainSubresourceDataProvider) { | ||
| $reflection = new \ReflectionProperty(ChainSubresourceDataProvider::class, 'dataProviders'); |
src/Bridge/Symfony/Bundle/DataProvider/TraceableChainSubresourceDataProvider.php
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,21 @@ | |||
| <?xml version="1.0" ?> | |||
There was a problem hiding this comment.
can me merged with the previous file isn't it?
There was a problem hiding this comment.
I wanted to activate those listener only if the api platform profiler is enable and debug is on but I can simplify and remove extra files if you prefer, let me know.
There was a problem hiding this comment.
got it finaly 👍
There was a problem hiding this comment.
got it finally 👍. I updated the file and added test on the extension. just waiting for github hangover to be finished
There was a problem hiding this comment.
got it finally 👍. I updated the file and added test on the extension. just waiting for github hangover to be finished
5bbeb47 to
a59ce7e
Compare
|
I've updated following your comments @dunglas, |
b4871f2 to
3000eda
Compare
|
everything has been updated here, just waiting for github webhooks to be back on the scene I guess now |
src/Bridge/Symfony/Bundle/DataProvider/TraceableChainCollectionDataProvider.php
Show resolved
Hide resolved
f362c97 to
d717d34
Compare
|
branched rebased. |
d717d34 to
35493dd
Compare
|
Thank you very much @antograssiot, very nice improvement |
* ApiPlatformExtension cleanup * Remove a now useless composer hack * remove unset attributes key in normalization context * Add tests on doctrine collection purge * Fix 2285 - force Yaml::dump to dump empty array as actual empty array * improve graphiql CSS * Prefix root resource route_prefix to sub-resources Unit test also added * Bump PHPStan analysis to level 6 (api-platform#2272) * Bump PHPStan analysis to level 6 * Bump PHPStan analysis to level 6 * Bump PHPStan analysis to level 6 * Deprecate dead code in QueryJoinParser and remove internal usage * Add a non regression test for api-platform#2285 api-platform#2286 * Ability to modify response headers (mainly cache related headers) (api-platform#2288) * Allow user-defined cache headers A user may wish to define response cache headers in a custom controller or per resource. E.g. a /entity/random endpoint should have a max-age of 0 * Override cache max-age and shared-max-age Add annotation attributes for cache_headers which allows max_age and shared_max_age to be assigned per resource. * Remove unused property The property was added when I thought it may be good to have the option outside of 'attributes' - decided to put the option in attributes instead and failed to remove this property. * Code style fixes * Test code style fix * Review changes applied - Order of constructor arguments + default null value - Remove 'throws' annotation - setting $resourceCacheHeaders with default fallback to empty array - Improved conditional statements * Add cacheHeaders Attribute annotation * Accidental typo * Alphabetical order Updated attribute annotation to alphabetical order - moved the property into alphabetical order as well * Add data providers and data persisters matches to the debug panel (api-platform#2262) * Add data providers and data persisters matches to the debug panel * Add tests on traceable providers and persisters * Use internal public properties * Merge config file and add tests on Extension * Avoid extra loop in data persister/providers * remove duplicated code * Fix after rebasing * Allow an input and an output for a given resource class * [Bugfix] Remove type Error

Even if I do like the data providers system, I generally find hard to debug them and end in dumping in vendor chain data providers.
This PR aims to provide a more developer friendly way to debug them by improving the Api Platform panel in Symfony debug toolbar

Up to now I've implemented item/collection/subresources data provider and data persister
If you like the idea, I'll add tests before merging this.