Skip to content

Commit

Permalink
Fix Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Oct 20, 2023
1 parent f6c99b7 commit f59d970
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 52 deletions.
62 changes: 31 additions & 31 deletions docs/configure_your_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ There are some basic CRUD operations and more.
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Index;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Index]
class Book implements ResourceInterface
{
Expand Down Expand Up @@ -68,10 +68,10 @@ namespace App\Entity;

use App\Grid\BookGrid;
use Sylius\Component\Resource\Metadata\Index;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
// You can use either the FQCN of your grid
#[Index(grid: BookGrid::class)]
// Or you can use the grid name
Expand Down Expand Up @@ -101,10 +101,10 @@ The iterator for your books will be available as `books.data` or `resources.data
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create]
class Book implements ResourceInterface
{
Expand Down Expand Up @@ -137,10 +137,10 @@ The iterator for your books will be available as `books.data` or `resources.data
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Update]
class Book implements ResourceInterface
{
Expand Down Expand Up @@ -171,10 +171,10 @@ On your Twig template, these variables are available
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Delete;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Delete]
class Book implements ResourceInterface
{
Expand All @@ -196,10 +196,10 @@ It will configure this route for your `delete` operation.
namespace App\Entity;

use Sylius\Component\Resource\Metadata\BulkDelete;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[BulkDelete]
class Book implements ResourceInterface
{
Expand All @@ -220,11 +220,11 @@ It will configure this route for your `bulk_delete` operation.
```php
namespace App\Entity;

use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Show;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Show]
class Book implements ResourceInterface
{
Expand Down Expand Up @@ -258,11 +258,11 @@ As an example, we add a `publish` operation to our book resource.
namespace App\Entity;

use Sylius\Component\Resource\Metadata\ApplyStateMachineTransition;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Show;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[ApplyStateMachineTransition(stateMachineTransition: 'publish')]
class Book implements ResourceInterface
{
Expand All @@ -286,10 +286,10 @@ It customizes the path for your operations.
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create(path: 'register')]
class Customer implements ResourceInterface
{
Expand All @@ -309,10 +309,10 @@ It customizes the path for your operations.
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create(shortName: 'register')]
class Customer implements ResourceInterface
{
Expand All @@ -337,12 +337,12 @@ namespace App\Entity;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\Index;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Show;
use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(templatesDir: 'book')]
#[AsResource(templatesDir: 'book')]
#[Index]
#[Create]
#[Update]
Expand Down Expand Up @@ -371,12 +371,12 @@ use Sylius\Component\Resource\Metadata\BulkDelete;
use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\Delete;
use Sylius\Component\Resource\Metadata\Index;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Show;
use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(routePrefix: 'admin')]
#[AsResource(routePrefix: 'admin')]
#[Index]
#[Create]
#[Update]
Expand Down Expand Up @@ -409,19 +409,19 @@ use Sylius\Component\Resource\Metadata\BulkDelete;
use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\Delete;
use Sylius\Component\Resource\Metadata\Index;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Show;
use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(section: 'admin', routePrefix: 'admin')]
#[AsResource(section: 'admin', routePrefix: 'admin')]
#[Index]
#[Create]
#[Update]
#[Delete]
#[BulkDelete]

#[ResourceMetadata(section: 'shop')]
#[AsResource(section: 'shop')]
#[Index]
#[Show]
class Book implements ResourceInterface
Expand Down Expand Up @@ -451,12 +451,12 @@ use Sylius\Component\Resource\Metadata\BulkDelete;
use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\Delete;
use Sylius\Component\Resource\Metadata\Index;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Show;
use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(identifier: 'code')]
#[AsResource(identifier: 'code')]
#[Index]
#[Create]
#[Update]
Expand Down Expand Up @@ -484,10 +484,10 @@ It defines the simple vars that you can use on your templates.
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(vars: ['header' => 'Library', 'subheader' => 'Managing your library'])]
#[AsResource(vars: ['header' => 'Library', 'subheader' => 'Managing your library'])]
#[Create(vars: ['subheader' => 'Adding a book'])]
class Book implements ResourceInterface
{
Expand Down
16 changes: 8 additions & 8 deletions docs/configure_your_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ It will configure your entity as a Sylius resource.
```php
namespace App\Entity;

use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
class Book implements ResourceInterface
{
}
Expand Down Expand Up @@ -75,10 +75,10 @@ It defines the resource name.
```php
namespace App\Entity;

use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(name: 'cart')]
#[AsResource(name: 'cart')]
class Order implements ResourceInterface
{
}
Expand All @@ -103,10 +103,10 @@ It defines the resource plural name.
```php
namespace App\Entity;

use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(pluralName: 'library')]
#[AsResource(pluralName: 'library')]
class Book implements ResourceInterface
{
}
Expand All @@ -131,10 +131,10 @@ It defines the simple vars that you can use on your templates.
```php
namespace App\Entity;

use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata(vars: ['header' => 'Library', 'subheader' => 'Managing your library'])]
#[AsResource(vars: ['header' => 'Library', 'subheader' => 'Managing your library'])]
class Book implements ResourceInterface
{
}
Expand Down
6 changes: 3 additions & 3 deletions docs/redirect.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ declare(strict_types=1);
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create(redirectToRoute: 'app_book_update')]
#[Update(redirectToRoute: 'app_book_update')]
class Book implements ResourceInterface
Expand Down Expand Up @@ -66,7 +66,7 @@ declare(strict_types=1);
namespace App\Entity;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\Model\ResourceInterface;

Expand Down
16 changes: 8 additions & 8 deletions docs/resource_factories.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ declare(strict_types=1);
namespace App\Entity\Book;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create(
path: 'authors/{authorId}/books',
factoryMethod: 'createWithCreator',
Expand Down Expand Up @@ -167,10 +167,10 @@ declare(strict_types=1);
namespace App\Entity\Book;

use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create(
path: 'authors/{authorId}/books',
factoryMethod: 'createForAuthor',
Expand All @@ -193,10 +193,10 @@ declare(strict_types=1);
namespace App\Entity\Book;

use App\Factory\BookFactory;use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create(
path: 'authors/{authorId}/books',
# Here we declared the factory to use with its fully classified class name
Expand Down Expand Up @@ -240,10 +240,10 @@ namespace App\Entity\Book;
use App\Entity\Book;
use App\Factory\BookFactory;
use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Create(
factory: [BookFactory::class, 'create'],
)]
Expand Down
4 changes: 2 additions & 2 deletions docs/responders.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ Use it on your operation.

namespace App\Entity;

use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Metadata\AsResource;
use Sylius\Component\Resource\Metadata\Show;
use Sylius\Component\Resource\Model\ResourceInterface;

#[ResourceMetadata]
#[AsResource]
#[Show(
template: 'subscription/show.html.twig',
twigContextFactory: ShowSubscriptionContextFactory::class,
Expand Down

0 comments on commit f59d970

Please sign in to comment.