api-platform.com

React-admin | How to concat source inside ReferenceField

有些话、适合烂在心里 提交于 2020-01-15 09:39:47
问题 I have a table "fos_user" and "version", I would like to display "9.0.1.A" instead of "/ version / 1". =>fos_user https://i.imgur.com/C8f0qor.png =>version https://i.imgur.com/HFSKIdz.png Is it possible to concatenate the fields of the "version" table to display it in the source, like this? https://i.imgur.com/rxJBmtp.png Because it will prevent me from creating a new field in the "version" table. Best regards, 回答1: React-admin | How to concat source inside ReferenceField ? Answer:

Saving related objects in API Platform

本小妞迷上赌 提交于 2020-01-15 09:36:48
问题 I am new to API Platform and Symfony 4 , I have a situation where we have 3 entity related to each other: User , Jobseeker , JobseekerLocation so when we need add register new Jobseeker can we make entry in related table automatically? Some kind of triggering. Or we should make 3 API call to reach and save the data? 回答1: Use the @Groups() https://api-platform.com/docs/core/serialization/ /** * @ApiResource() */ class User { /** * @Groups({"registration"}) * @ORM\ManyToOne/OneToOne(...) */

Saving related objects in API Platform

别来无恙 提交于 2020-01-15 09:36:05
问题 I am new to API Platform and Symfony 4 , I have a situation where we have 3 entity related to each other: User , Jobseeker , JobseekerLocation so when we need add register new Jobseeker can we make entry in related table automatically? Some kind of triggering. Or we should make 3 API call to reach and save the data? 回答1: Use the @Groups() https://api-platform.com/docs/core/serialization/ /** * @ApiResource() */ class User { /** * @Groups({"registration"}) * @ORM\ManyToOne/OneToOne(...) */

How to use "paramconverter with API-Platform?

流过昼夜 提交于 2020-01-03 02:00:07
问题 How to implement or use paramconverter with Symfony API platform? I want to use entity ID on the route and generate immediately an object, ready to be used in the controller. I'm not using annotations on this project. Route configurations are in the YAML file. resources: App\Meetings\Domain\Entity\Meeting: collectionOperations: invitation_response: method: 'POST' path: 'users/{id}' controller: 'App\Controller\User\IndexController' defaults: _api_receive: false 回答1: Why not use a decorator? E

How to save a Nested Relation with Entity on API Platform

早过忘川 提交于 2020-01-03 01:41:09
问题 I have two entities, Question and Alternative where Question has a OneToMany relation with Alternative and I'm trying to send a JSON with a nested document of Alternative on it via POST to Question API Platform. The API Platform returns that error below : Nested documents for "alternatives" attribute are not allowed. Use IRIs instead. Searching about it I've found some people saying that is only possible using IRIs and some other people saying that is possible to use Denormalization and

API Platform - how to document authentication routes

孤者浪人 提交于 2020-01-02 07:21:08
问题 I'm using API Platform v2.2.5 in a Symfony 4 Flex application, consisting of a functioning API with JWT Authentication, a number of resources and the default Open API/Swagger documentation page that is accessible via the /api route. Each API resource is included in the documentation automatically via the platform configuration, as per the library docs. How do you generate documentation for custom operations such as the security component's auth routes? The API Platform Documentation does not

Api-platform request issue

这一生的挚爱 提交于 2019-12-24 19:26:51
问题 I have two entities author and book book | manytoOne |author id | |id idAuthor | in the author controller i have an Action function that gets the author details and all his books (using the forward function to get the books) public function authorDetailsAction($id){ $author= $this->getDoctrine()->getRepository(Author::class)->find($id); $books= $this->forward('AppBundle:Book:authorBooks',array('id' => $id)); return array('author' => $author, 'books' => $books); } but it shows only author

How can I annotate my attribute which is Value Object in order that API Platform would generate its fields for swagger documentation?

你离开我真会死。 提交于 2019-12-24 19:16:53
问题 I have an Entity called Station . This entity has a property called attributes which is StationAttributes value object. I try to set the property to be StationAttributes : /** * @var StationAttributes * @ORM\Column(name="attributes", type="station_attributes", nullable=true) */ private $attributes; However, the API Platform generates Station model that looks like this: { ... "attributes": "string" } I want it to be like this: { ... "attributes": { "field": true, "field2": "value2", } } How

How can I annotate my attribute which is Value Object in order that API Platform would generate its fields for swagger documentation?

梦想与她 提交于 2019-12-24 19:13:10
问题 I have an Entity called Station . This entity has a property called attributes which is StationAttributes value object. I try to set the property to be StationAttributes : /** * @var StationAttributes * @ORM\Column(name="attributes", type="station_attributes", nullable=true) */ private $attributes; However, the API Platform generates Station model that looks like this: { ... "attributes": "string" } I want it to be like this: { ... "attributes": { "field": true, "field2": "value2", } } How

Api-Platform: Using Yaml config instead of annotations in SF 4

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 09:27:53
问题 I'd like to use YAML instead of annotations in Api-Platform. Instead of using the Api-Platform distribution, I have added the api-pack into my existing Symfony Flex project ( composer req api ). The documentation says the YAML file should take place in /config/api_platform/resources.yaml but my entities aren't discovered. Should I configure something somewhere else? Thank you, Ben 回答1: The only thing you need to do is to add the following configuration: api_platform: mapping: paths: ['%kernel