api-platform.com

ReferenceInput just loads one page of reference ids as dropdown. How to have a lazy loading or infinitely paginating selection

蹲街弑〆低调 提交于 2019-12-11 17:18:51
问题 For example i have Product with Image Object as the entity that handles the image . While Creating/Editing I need to select any imageobject that i have created, but i cannot . The dropdown seems to only load the first page results ( based on ItemsperPage ) Product : name: Text Image : ImageObject http://localhost:8080/api/image_objects?order%5Bid%5D=DESC&page=1&perPage=25 as seen on the network inspector in the admin page. 来源: https://stackoverflow.com/questions/57698476/referenceinput-just

Extra data on a collection operation

ぃ、小莉子 提交于 2019-12-11 16:56:24
问题 Does anybody know how to add extra data on a collection ? The doc says much about how to add extra data on an item which translates into decorating the ItemNormalizer service, and it works pretty well. But I’m struggling in finding out which normalizer to decorate when it comes to add some data on a collection of entities. The extra data could be anything: the current user logged in, a detailed pager, some debug parameters, ... that are not related to a specific entity, but rather on the

Where are default API Platform operations are stored?

痴心易碎 提交于 2019-12-11 16:42:44
问题 I would like to know where are default API Platform operations (CRUD methods) are stored so that I can call them wherever I need. I need it because when I define my custom operations, I want to call them (default operations) so that I don't need to rewrite the code (like, get a collection of resource). For example: class GetResourceListAction { public function __invoke() { //Do my things here //And finally call default operation which return collection } } Thank you 回答1: As described in the

API Platform model attributes are readOnly

谁说我不能喝 提交于 2019-12-11 12:12:19
问题 I'm struggling with this strange behavior with my API: some of the attributes are set to readOnly: true . EDIT: This is how my entities are defined /** * @ApiResource( * normalizationContext={"groups"={"read_partenaire"}}, * denormalizationContext={"groups"={"write_partenaire"}} * ) * @ORM\Entity(repositoryClass="App\Repository\ProfessionnelRepository") * @ApiFilter(SearchFilter::class, properties={"nom": "partial", "id": "exact"}) */ class Professionnel { /** * @ORM\Id() * @ORM

Installing the Framework (Problem cURL error 6: Could not resolve host: cache-proxy)

霸气de小男生 提交于 2019-12-11 04:29:34
问题 I tried to install api-platform: https://api-platform.com/docs/distribution/ after starting I see in the log "api-platform-242_cache-proxy_1" │ Error: │ │ Message from VCC-compiler: │ │ Expected return action name. │ │ ('/usr/local/etc/varnish/default.vcl' Line 67 Pos 13) │ │ return (miss); │ │ ------------####-- │ │ Running VCC-compiler failed, exited with 2 │ │ VCL compilation failed If I use the api (post greeting), the response code is 500 "hydra:description": "cURL error 6: Could not

Api-Platform: using PUT for creating resources

旧巷老猫 提交于 2019-12-11 04:08:03
问题 I would like to use the PUT method for creating resources. They are identified by an UUID, and since it is possible to create UUIDs on the client side, I would like to enable the following behaviour: on PUT /api/myresource/4dc6efae-1edd-4f46-b2fe-f00c968fd881 if this resource exists, update it on PUT /api/myresource/4dc6efae-1edd-4f46-b2fe-f00c968fd881 if this resource does not exist, create it It's possible to achieve this by implementing an ItemDataProviderInterface /

API won't stop eager loading

泄露秘密 提交于 2019-12-11 02:12:19
问题 I'm reading the docs here: https://api-platform.com/docs/core/performance/#eager-loading No matter what config I try, my API always eager loads relations in my payload. Why is the API Platform ignoring these settings? I've tried this to no avail # api/config/packages/api_platform.yaml api_platform: eager_loading: force_eager: false # also tried this api_platform: eager_loading: enabled: false I've also tried annotations on my entity & relationship /** * @ApiResource(attributes={"force_eager"

api platform - Unable to generate an IRI for the item

不羁岁月 提交于 2019-12-09 18:38:43
问题 I'm starting with API Platform and I'm using the example entity "Foo": namespace AppBundle\Entity; use ApiPlatform\Core\Annotation\ApiResource; use Doctrine\ORM\Mapping as ORM; /** * Foo * * @ORM\Table(name="foo") * @ApiResource * @ORM\Entity */ class Foo { /** * @var string * * @ORM\Column(name="bar", type="string", length=255, nullable=false) */ private $bar; /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; }

How to save a Nested Relation with Entity on API Platform

心不动则不痛 提交于 2019-12-08 16:15:40
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 Normalization contexts to solve this problem but I can't find some example or tutorial about it. TL;DR; Is

api-platform.com Unable to generate an IRI for the item of type

空扰寡人 提交于 2019-12-08 13:37:14
问题 I'm trying to setup my first api-platform instance and have run into some presumably noob questions around IDE. What I'm trying to do is setting up an register and reset entity in order to deal with registrations and password reminders from an app. And then have the entity's passed to a custom controller to do some checks, balances and mails afterwards (haven’t gotten around to that yet). But I keep running into this error when posting to my custom entities: { "@context": "/api/contexts/Error