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

Issues found on 2.7 #4613

Closed
vincentchalamon opened this issue Jan 3, 2022 · 141 comments · Fixed by #4719 or #4738
Closed

Issues found on 2.7 #4613

vincentchalamon opened this issue Jan 3, 2022 · 141 comments · Fixed by #4719 or #4738
Labels

Comments

@vincentchalamon
Copy link
Contributor

vincentchalamon commented Jan 3, 2022

Write here as comment the errors you may found on api-platform/core:2.7.x-dev installed on your project. Please mention:

  • the error message
  • the related code if possible
  • the service declaration, if specified
  • the PHP version
  • the Symfony version
  • a fix proposal, if possible
@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon
Copy link
Contributor Author

  • PHP 8.0.14
  • Symfony 5.3.*

HTTP 400 invalid filters error message has changed from "detail": "..." to "hydra:description": "..."

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@vincentchalamon

This comment was marked as resolved.

@dgfmdrv

This comment was marked as resolved.

@divine

This comment was marked as resolved.

@alanpoulain alanpoulain pinned this issue Apr 10, 2022
@darthf1

This comment was marked as resolved.

@zakjakub

This comment was marked as resolved.

@RobinHoutevelts
Copy link
Contributor

TypeError : ApiPlatform\Core\Bridge\Elasticsearch\DataProvider\CollectionDataProvider::__construct(): Argument #5 ($pagination) must be of type ApiPlatform\State\Pagination\Pagination, ApiPlatform\Core\DataProvider\Pagination given

The CollectionDataProvider is configured to use ApiPlatform\State\Pagination\Pagination which is the api_platform.pagination service.

However in the legacy/backward_compatibility.xml config the api_platform.pagination service is overwritten and marked an alias for api_platform.pagination.legacy, causing an error when fetching the CollectionDataProvider from the container.

@soyuka

This comment was marked as resolved.

@soyuka

This comment was marked as resolved.

@darthf1

This comment was marked as resolved.

@KDederichs
Copy link
Contributor

Yeah Ok found it, it's picking up on the getter for the GroupSequenceProvider and it's fixable by ignoring it in serialization.
I guess I'll add a doc PR for that since I assume that's also an issue in older versions.

@yobrx
Copy link
Contributor

yobrx commented Aug 14, 2022

Hi,

How initialize input DTO for partial update on 2.7/3.0 ?

DataTransformerInitializerInterface is deprecated on 2.7, removed on 3.0 but i can't found an alternative for this.

I must use DenormalizerInterface ?

@rvanlaak
Copy link

Not sure if this also is the place where to report 3.0.0-rc.2 issues, but I've created #4897 for an exception on GraphiQL when twig is not enabled.

@Zul3s
Copy link

Zul3s commented Aug 16, 2022

Hello @yobrx ,
Api Platform >= 2.7 "replace" DateTransformer by State providers and State processors.
You can found documentation here : https://api-platform.com/docs/main/core/dto/ .
Please, make sur you use documentation for 2.7 (on the top at left).

@RobinHoutevelts
Copy link
Contributor

RobinHoutevelts commented Aug 16, 2022

( Also unclear to me how to migrate from DataTransformerInitializerInterface. Even after reading the docs. For example I just want to update the title attribute without having to send all other attributes. )

@yobrx
Copy link
Contributor

yobrx commented Aug 17, 2022

@Zul3s Hello ! I have read the good page of documentation before post my message, and unlike version 2.6, 2.7 doesn't mention how to proceed for a patch :(

@lchrusciel
Copy link
Contributor

Minor thing -

the ApiPlatform\Core\Metadata\Resource\ResourceNameCollection class exists in AP2.6, but it was moved to ApiPlatform\Metadata\Resource\ResourceNameCollection, the Core was removed. It is not a big problem, but kind of BC Break

@alanpoulain
Copy link
Member

@lchrusciel I think this behavior is normal: if you migrate from 2.6 to 2.7 you should have deprecations for the namespace changes.
Once you have resolved the deprecations, the upgrade path is to migrate your attributes and disable the BC layer (metadata_backward_compatibility_layer: false).
And then you can upgrade to 3.0.
More details here: https://api-platform.com/docs/main/core/upgrade-guide/

@Zul3s
Copy link

Zul3s commented Aug 22, 2022

Hello @vincentchalamon ,
Did you have any news ?
Can i help you ?

@vincentchalamon
Copy link
Contributor Author

Hi @Zul3s, the PR is still in review. But as a lot of people are still in holidays, reviews can be slower than usual.

@MariusJam
Copy link
Contributor

Hi,

I'm currently testing the upgrade to API-P 2.7-rc2 and I have question regarding custom doctrine extensions. We are indeed using a lot of those currently and have implemented them in the 2.6 way.

On 2.7, these extensions are not passed any more in the $extensions parameter of our DataProviders.

Given:

services:
    'App\DataProvider\CommitmentStepDataProvider':
        arguments:
            $extensions: !tagged api_platform.doctrine.orm.query_extension.collection
class CommitmentStepDataProvider implements ContextAwareCollectionDataProviderInterface
{
    public function __construct(
        iterable $extensions
    ) {
        foreach ($extensions as $extension) {
            dump($extension);
        }
    }
}
  • In 2.6 the dump returns all our custom extensions + those of API-P (FilterExtension, EagerLoadingExtension, etc.)
  • In 2.7 the dump returns only the extensions of API-P.

Is that normal that there is no backward compatibility here?

@soyuka
Copy link
Member

soyuka commented Sep 1, 2022

@MariusJam does the debug:container with the extension tag shows your extensions ? What interface do you use ? The metadata flag was kept to default ?

@MariusJam
Copy link
Contributor

Hi @soyuka,

debug:container shows the extensions both in 2.6 and 2.7. However, in 2.7, the tags row is empty whereas it is not in 2.6:

---------------- --------------------------------------------------- 
  Option           Value                                              
 ---------------- --------------------------------------------------- 
  Service ID       App\Doctrine\InscriptionCollectionFilterExtension  
  Class            App\Doctrine\InscriptionCollectionFilterExtension  
  Tags             -                                                  
  Public           no                                                 
  Synthetic        no                                                 
  Lazy             no                                                 
  Shared           yes                                                
  Abstract         no                                                 
  Autowired        yes                                                
  Autoconfigured   yes                                                
 ---------------- --------------------------------------------------- 

Concerning the interfaces, that depends of the extension but we can use:

  • ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\ContextAwareQueryCollectionExtensionInterface;
  • ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryCollectionExtensionInterface
  • ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryItemExtensionInterface
  • A mix of those

But in each case, the tags row remains empty in 2.7.

For the metadata flag, I've just upgraded to 2.7 so far so yes, I kept it to default.

@soyuka
Copy link
Member

soyuka commented Sep 2, 2022

Okay this is because you rely on autoconfiguration, I'll provide a fix thanks for the details.

@DesLynx
Copy link

DesLynx commented Sep 6, 2022

Hi!

The Cursor Based Pagination doesn't seems to work.

@RobinHoutevelts
Copy link
Contributor

Why has this issue been closed?

@soyuka soyuka unpinned this issue Sep 16, 2022
@norkunas
Copy link
Contributor

norkunas commented Oct 6, 2022

( Also unclear to me how to migrate from DataTransformerInitializerInterface. Even after reading the docs. For example I just want to update the title attribute without having to send all other attributes. )

So are there any suggestions how to work with input dto without DataTransformerInitializer for PUT requests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet