Core: A ressource cannot be transversable or apiplatform throws an error

Created on 20 Dec 2017  路  10Comments  路  Source: api-platform/core

If my resource implement ArrayAccess, then I can't use it with ApiPlatform because the class cannot be resolved anymore.

Here is the related problematic code:

https://github.com/api-platform/core/blob/0ed9a024c2d2914fd571dd446dfe7e4dbf5465f6/src/Api/ResourceClassResolver.php#L42-L51

A solution is to add my custom normalizer but in that case I can't benefit of the jsonld ItemNormalizer.

enhancement

Most helpful comment

@teohhanhui I meant "it is... fixed on master" 馃槃

All 10 comments

This code part is kinda sensitive but I think we would accept a patch for this.

@soyuka as you say, it's extremely sensitive. And I'm not sure it's an enhancement. It seems more like a bug.

Also fixing it is a (probably) huge BC break: for example we will probably not be able to throw a InvalidArgumentException after that.

What's your feeling about ?

My feeling? If I were you I would patch this (also add the fix the Dictionary) - on master - and do a pull request or launch the test suite to check if something break haha.

I meant, what is your feeling about the BC break.

Why is there an sprintf with no arguments in the first place :laughing: .

I'm not sure to understand what change you're going to apply in this class and therefore can't comment. Please propose a patch and we'll discuss it there :stuck_out_tongue: .

@soyuka do you think it should be fixed on master only or for both master and 2.1?

IMO it should be fixed on master.

It is!

@Nek- Is this still a problem?

@teohhanhui I meant "it is... fixed on master" 馃槃

Was this page helpful?
0 / 5 - 0 ratings