Skip to content

Commit

Permalink
Deprecate QueryStringBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored and greg0ire committed Feb 19, 2020
1 parent 4d66e85 commit a541c44
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public function batchActionDelete(ProxyQueryInterface $query)
public function deleteAction($id)
{
$request = $this->getRequest();

// NEXT_MAJOR: remove the next line and use the $id parameter of the function
$id = $request->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);

Expand Down Expand Up @@ -284,12 +286,13 @@ public function deleteAction($id)
*
* @return Response|RedirectResponse
*/
public function editAction($id = null)
public function editAction($id = null) // NEXT_MAJOR: Remove the $id default value
{
$request = $this->getRequest();
// the key used to lookup the template
$templateKey = 'edit';

// NEXT_MAJOR: remove the next line and use the $id parameter of the function
$id = $request->get($this->admin->getIdParameter());
$existingObject = $this->admin->getObject($id);

Expand Down Expand Up @@ -664,11 +667,12 @@ public function createAction()
*
* @return Response
*/
public function showAction($id = null)
public function showAction($id = null) // NEXT_MAJOR: Remove the $id default value
{
$request = $this->getRequest();
$id = $request->get($this->admin->getIdParameter());

// NEXT_MAJOR: remove the next line and use the $id parameter of the function
$id = $request->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);

if (!$object) {
Expand Down Expand Up @@ -720,11 +724,12 @@ public function showAction($id = null)
*
* @return Response
*/
public function historyAction($id = null)
public function historyAction($id = null) // NEXT_MAJOR: Remove the $id default value
{
$request = $this->getRequest();
$id = $request->get($this->admin->getIdParameter());

// NEXT_MAJOR: remove the next line and use the $id parameter of the function
$id = $request->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);

if (!$object) {
Expand Down Expand Up @@ -771,11 +776,12 @@ public function historyAction($id = null)
*
* @return Response
*/
public function historyViewRevisionAction($id = null, $revision = null)
public function historyViewRevisionAction($id = null, $revision = null) // NEXT_MAJOR: Remove the $id default value
{
$request = $this->getRequest();
$id = $request->get($this->admin->getIdParameter());

// NEXT_MAJOR: remove the next line and use the $id parameter of the function
$id = $request->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);

if (!$object) {
Expand Down Expand Up @@ -836,14 +842,14 @@ public function historyViewRevisionAction($id = null, $revision = null)
*
* @return Response
*/
public function historyCompareRevisionsAction($id = null, $base_revision = null, $compare_revision = null)
public function historyCompareRevisionsAction($id = null, $base_revision = null, $compare_revision = null) // NEXT_MAJOR: Remove the $id default value
{
$request = $this->getRequest();

$this->admin->checkAccess('historyCompareRevisions');

// NEXT_MAJOR: remove the next line and use the $id parameter of the function
$id = $request->get($this->admin->getIdParameter());

$object = $this->admin->getObject($id);

if (!$object) {
Expand Down Expand Up @@ -969,16 +975,16 @@ public function exportAction(Request $request)
*
* @return Response|RedirectResponse
*/
public function aclAction($id = null)
public function aclAction($id = null) // NEXT_MAJOR: Remove the $id default value
{
$request = $this->getRequest();

if (!$this->admin->isAclEnabled()) {
throw $this->createNotFoundException('ACL are not enabled for this admin');
}

// NEXT_MAJOR: remove the next line and use the $id parameter of the function
$id = $request->get($this->admin->getIdParameter());

$object = $this->admin->getObject($id);

if (!$object) {
Expand Down
4 changes: 4 additions & 0 deletions src/Route/QueryStringBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
use Sonata\AdminBundle\Model\AuditManagerInterface;

/**
* NEXT_MAJOR: remove this class.
*
* @final since sonata-project/admin-bundle 3.52
*
* @deprecated since 3.x, to be removed with 4.0
*
* @author Thomas Rabaix <[email protected]>
*/
class QueryStringBuilder implements RouteBuilderInterface
Expand Down

0 comments on commit a541c44

Please sign in to comment.