Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some Symfony Deprecations #338

Merged
merged 7 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions docs/create_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ app_book_create:
path: /books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
```
Done! Now when you go to ``/books/new``, the ResourceController will use the factory (``app.factory.book``) to create a new book instance.
Then it will try to create an ``app_book`` form, and set the newly created book as its data.
Expand Down Expand Up @@ -38,7 +38,7 @@ app_book_create:
path: /books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
template: Book/create.html.twig
```
Expand All @@ -55,7 +55,7 @@ app_book_create:
path: /books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
form: App\Form\BookType
```
Expand All @@ -73,7 +73,7 @@ app_book_create:
path: /books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
form:
type: App\Form\BookType
Expand All @@ -92,7 +92,7 @@ app_book_create:
path: /books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
factory: createNewWithAuthor
```
Expand All @@ -105,7 +105,7 @@ app_book_create:
path: /books/{author}/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
factory:
method: createNewWithAuthor
Expand All @@ -124,7 +124,7 @@ app_book_create:
path: /{authorId}/books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
factory:
method: ["expr:service('app.factory.custom_book_factory')", "createNewByAuthorId"]
Expand All @@ -145,7 +145,7 @@ app_book_create:
path: /books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
redirect: app_book_index
```
Expand All @@ -158,7 +158,7 @@ app_book_create:
path: /genre/{genreId}/books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
redirect:
route: app_genre_show
Expand All @@ -173,7 +173,7 @@ app_book_create:
path: /books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
redirect:
route: app_book_show
Expand All @@ -194,7 +194,7 @@ app_book_customer_create:
path: /customer/books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
event: customer_create
```
Expand All @@ -210,7 +210,7 @@ app_genre_book_add:
path: /{genreName}/books/add
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_controller: app.controller.book::createAction
_sylius:
template: Book/addToGenre.html.twig
form: App\Form\BookType
Expand Down
10 changes: 5 additions & 5 deletions docs/delete_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ app_book_delete:
path: /books/{id}
methods: [DELETE]
defaults:
_controller: app.controller.book:deleteAction
_controller: app.controller.book::deleteAction
```
## Calling an Action with DELETE method

Expand Down Expand Up @@ -39,7 +39,7 @@ app_book_delete:
path: /genre/{genreId}/books/{id}
methods: [DELETE]
defaults:
_controller: app.controller.book:deleteAction
_controller: app.controller.book::deleteAction
_sylius:
criteria:
id: $id
Expand All @@ -58,7 +58,7 @@ app_book_delete:
path: /genre/{genreId}/books/{id}
methods: [DELETE]
defaults:
_controller: app.controller.book:deleteAction
_controller: app.controller.book::deleteAction
_sylius:
redirect:
route: app_genre_show
Expand All @@ -78,7 +78,7 @@ app_book_customer_delete:
path: /customer/book-delete/{id}
methods: [DELETE]
defaults:
_controller: app.controller.book:deleteAction
_controller: app.controller.book::deleteAction
_sylius:
event: customer_delete
```
Expand All @@ -96,7 +96,7 @@ app_genre_book_remove:
path: /{genreName}/books/{id}/remove
methods: [DELETE]
defaults:
_controller: app.controller.book:deleteAction
_controller: app.controller.book::deleteAction
_sylius:
event: book_delete
repository:
Expand Down
14 changes: 7 additions & 7 deletions docs/index_resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ app_book_index:
path: /books
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_controller: app.controller.book::indexAction
```
When you go to ``/books``, the ResourceController will use the repository (``app.repository.book``) to create a paginator.
The default template will be rendered - ``App:Book:index.html.twig`` with the paginator as the ``books`` variable.
Expand All @@ -29,7 +29,7 @@ app_book_index_inactive:
path: /books/disabled
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_controller: app.controller.book::indexAction
_sylius:
filterable: true
criteria:
Expand All @@ -49,7 +49,7 @@ app_book_index_top:
path: /books/top
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_controller: app.controller.book::indexAction
_sylius:
sortable: true
sorting:
Expand Down Expand Up @@ -78,7 +78,7 @@ app_book_index_top:
path: /books/top
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_controller: app.controller.book::indexAction
_sylius:
paginate: 5
sortable: true
Expand All @@ -99,7 +99,7 @@ app_book_index_top3:
path: /books/top
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_controller: app.controller.book::indexAction
_sylius:
paginate: false
limit: 3
Expand All @@ -119,7 +119,7 @@ app_book_index:
path: /{author}/books
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_controller: app.controller.book::indexAction
_sylius:
serialization_groups: { 0: Default, items: [ Custom ] }
```
Expand All @@ -136,7 +136,7 @@ app_book_index:
path: /{author}/books
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_controller: app.controller.book::indexAction
_sylius:
template: Author/books.html.twig
repository:
Expand Down
12 changes: 6 additions & 6 deletions docs/show_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ app_book_show:
path: /books/{id}
methods: [GET]
defaults:
_controller: app.controller.book:showAction
_controller: app.controller.book::showAction
```
Done! Now when you go to ``/books/3``, ResourceController will use the repository (``app.repository.book``) to find a Book with the given id (``3``).
If the requested book resource does not exist, it will throw a ``404 Not Found`` exception.
Expand All @@ -32,7 +32,7 @@ app_admin_book_show:
path: /admin/books/{id}
methods: [GET]
defaults:
_controller: app.controller.book:showAction
_controller: app.controller.book::showAction
_sylius:
template: Admin/Book/show.html.twig
```
Expand All @@ -50,7 +50,7 @@ app_book_show:
path: /books/{title}
methods: [GET]
defaults:
_controller: app.controller.book:showAction
_controller: app.controller.book::showAction
_sylius:
criteria:
title: $title
Expand All @@ -71,7 +71,7 @@ app_book_show:
path: /books/{author}
methods: [GET]
defaults:
_controller: app.controller.book:showAction
_controller: app.controller.book::showAction
_sylius:
repository:
method: findOneNewestByAuthor
Expand All @@ -90,7 +90,7 @@ app_book_show:
path: /books/{author}
methods: [GET]
defaults:
_controller: app.controller.book:showAction
_controller: app.controller.book::showAction
_sylius:
repository:
method: ["expr:service('app.repository.custom_book_repository')", "findOneNewestByAuthor"]
Expand All @@ -108,7 +108,7 @@ app_book_show:
path: /books/{author}
methods: [GET]
defaults:
_controller: app.controller.book:showAction
_controller: app.controller.book::showAction
_sylius:
template: Book/show.html.twig
repository:
Expand Down
20 changes: 10 additions & 10 deletions docs/update_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ app_book_update:
path: /books/{id}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
```
Done! Now when you go to ``/books/5/edit``, ResourceController will use the repository (``app.repository.book``) to find the book with id == **5**.
If found it will create the ``app_book`` form, and set the existing book as data.
Expand Down Expand Up @@ -38,7 +38,7 @@ app_book_update:
path: /books/{id}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
template: Admin/Book/update.html.twig
```
Expand All @@ -54,7 +54,7 @@ app_book_update:
path: /books/{id}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
form: App\Form\BookType
```
Expand All @@ -71,7 +71,7 @@ app_book_update:
path: /books/{id}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
form:
type: app_book_custom
Expand All @@ -90,7 +90,7 @@ app_book_update:
path: /books/{title}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
criteria: { title: $title }
```
Expand All @@ -106,7 +106,7 @@ app_book_update:
path: /books/{id}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
redirect: app_book_index
```
Expand All @@ -119,7 +119,7 @@ app_book_update:
path: /genre/{genreId}/books/{id}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
redirect:
route: app_genre_show
Expand All @@ -139,7 +139,7 @@ app_book_customer_update:
path: /customer/book-update/{id}
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
event: customer_update
```
Expand All @@ -159,7 +159,7 @@ app_book_update:
path: /books/{title}/edit
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
criteria: { title: $title }
return_content: true
Expand All @@ -178,7 +178,7 @@ app_book_update:
path: /genre/{genreId}/books/{title}/edit
methods: [GET, PUT, PATCH]
defaults:
_controller: app.controller.book:updateAction
_controller: app.controller.book::updateAction
_sylius:
template: Book/editInGenre.html.twig
form: app_book_custom
Expand Down
5 changes: 0 additions & 5 deletions src/Bundle/Doctrine/ORM/EntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
namespace Sylius\Bundle\ResourceBundle\Doctrine\ORM;

use Doctrine\ORM\EntityRepository as BaseEntityRepository;
use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Adapter\ArrayAdapter;
use Pagerfanta\Doctrine\ORM\QueryAdapter;
use Pagerfanta\Pagerfanta;
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;

/** @psalm-suppress DeprecatedInterface */
Expand Down
9 changes: 9 additions & 0 deletions src/Bundle/Doctrine/ORM/ResourceRepositoryTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\Bundle\ResourceBundle\Doctrine\ORM;
Expand Down
Loading