question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

have handle on GET/POST/DELETE/PUT method

See original GitHub issue

For a specific project i would like not use CRUD but keep handing on differents methods.

# In src/AppBundle/Entity/Book.php
<?php

  @ORM\Entity
  @ApiResource(
  itemOperations={
      "get"={"method"="GET"},
      "put"={"method"="PUT"},
      "delete"={"method"="DELETE"},
      "special"={"route_name"="book_special"},
      "specialget"={"route_name"="book_special"},
  }
  )
# In src/AppBundle/Action/BookSpecial.php
<?php
    
     @Route(
          name="book_special",
          path="/books/{id}/special",
          defaults={"_api_resource_class"=Book::class, "_api_item_operation_name"="special"}
      )
      @Method({"GET", "PUT"})

I must create a file for each method (GET,PUT,DELETE,…) and change route_name or can use controller and define each method?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
soyukacommented, May 5, 2017

Just implement a DataProvider if you want to do custom queries. There are really a few use cases where a Controller is valid with ApiPlatform. Most of the use cases can be dealt with by implementing one of those:

  • Filter (soon will also be possible without doctrine)
  • DataProvider (don’t need to be doctrine specific)
  • QueryExtension
0reactions
Simperfitcommented, Apr 6, 2018

It seems that all the linked PRs have been merged. This can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP REQUEST Methods-GET, POST, PUT, PATCH, DELETE.
In this article, we are going to learn the most common HTTP methods(POST, GET, PUT, PATCH, DELETE). If you are a beginner then...
Read more >
Using HTTP Methods for RESTful Services - REST API Tutorial
HTTP methods tutorial on how to use them for RESTful API or Web Service. ... methods, as they are properly called) are POST,...
Read more >
Handle HTTP POST, PUT, GET and HTTP Delete Requests
Click the below link to download the Java Source code and PPT: ...
Read more >
HTTP request methods - MDN Web Docs
Chrome Edge CONNECT Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history DELETE Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history GET Full...
Read more >
HTTP Request Methods – Get vs Put vs Post Explained with ...
HTTP Protocol; Client-server architecture; APIs. By the end of this article you'll have a good understanding of the functions of each request ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found