Comments (5)
id
is hardcoded in some part of the bundle. As a property called @id
is required by JSON-LD, I can sleep with the requirement of having a public $id
property or a getId()
method defined. Just consider it as the value of @id
.
There is nothing preventing to create getId()
method even if it's not the property name used by Doctrine. And some edge cases such as composed primary keys are not compatible with JSON-LD anyway.
I don't want to create a hard dependency against Doctrine (we currently use the bundle with other data providers such as Elastic Search, web services...). If you want to make the method used configurable, an entry in https://github.com/dunglas/DunglasApiBundle/blob/master/Mapping/ClassMetadata.php looks better to me.
from core.
Yes, my PR introduce an hard dependancy with doctrine. I'm looking for a better solution to remove that
from core.
My proposal:
- create a
$identifier
property in https://github.com/dunglas/DunglasApiBundle/blob/master/Mapping/ClassMetadata.php and in the relative interface with a default value beingid
- create a
DoctrineIdentifierLoader
in https://github.com/dunglas/DunglasApiBundle/tree/master/Mapping/Loader populating that property using your code - load the new loader only if Doctrine ORM is enable (in
Resources/config/doctrine_orm.xml
). - in the
IriConverter
class (and probably in other part of the bundle), use that metadata
What do you think?
from core.
I think your solution is better and remove the dependancy with doctrine.
I write the code and do a PR this afternoon if it's ok ;)
from core.
Perfect :)
from core.
Related Issues (20)
- Mixing IRIs between resources and sub-resources when using DTO HOT 2
- Doctrine ODM SearchFilter with embedded documents HOT 3
- Asset mapper warnings HOT 9
- Attempted to call an undefined method named "withParameterName" of class "ApiPlatform\Metadata\ApiProperty" HOT 1
- OpenAPI on calculated field add an extra `items` fields even if `openApiContext` define an object HOT 3
- Validation doesn't work proppperly with strict types HOT 1
- Add a way to configure default strategy mode for the SearchFilter
- Handle null request in ReadProvider HOT 1
- Upgrade to Symfony 7.1 seems to be breaking container linting
- Broken with symfony 7.1 HOT 2
- Unable to generate an IRI for the item of type App\ApiResource\*** with an UriTemplate HOT 1
- Support for JsonProblem (RFC 7807) Extension Member HOT 2
- Remove hydra prefix
- Filters incompatible with PHP 8.2.20 and 8.3.8 HOT 22
- Implement getType for ODM DoctrineExtractor HOT 1
- Mixing REST and GraphQL operation names HOT 3
- Access checks for a DTO created through a resolver should happen after it was created HOT 2
- Doctrine ODM Documents return inconsistent data for GET Collection and Item Operations in Symfony production environment HOT 1
- Calling GraphQL DeleteMutation ignores serialization groups and causes error HOT 2
- securityPostValidation argument on ApiResource and operations attributes is ignored when having use_symfony_listeners: true HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.