PHP code example of alexandrebulete / ddd-sylius-bundle

1. Go to this page and download the library: Download alexandrebulete/ddd-sylius-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alexandrebulete / ddd-sylius-bundle example snippets


return [
    // ...
    AlexandreBulete\DddSyliusBundle\DddSyliusBundle::class => ['all' => true],
];

use AlexandreBulete\DddSyliusBundle\Admin\Menu\MenuContributorInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

#[AutoconfigureTag('app.menu_contributor')]
final readonly class PostMenuContributor implements MenuContributorInterface
{
    public function contribute(ItemInterface $menu): void
    {
        $menu
            ->addChild('posts', [
                'route' => 'app_admin_post_index',
            ])
            ->setLabel('Posts')
            ->setLabelAttribute('icon', 'tabler:article');
    }
}

use AlexandreBulete\DddSyliusBundle\Grid\GridPageResolver;

$page = GridPageResolver::getCurrentPage($grid, $parameters);
$itemsPerPage = GridPageResolver::getItemsPerPage($grid, $parameters);

src/
├── DddSyliusBundle.php
├── Admin/
│   └── Menu/
│       ├── MenuBuilder.php
│       └── MenuContributorInterface.php
├── Grid/
│   └── GridPageResolver.php
└── Resources/
    └── config/
        ├── services.php
        └── sylius_resource.yaml

src/Post/
├── Domain/
│   └── Model/Post.php
├── Infrastructure/
│   ├── Sylius/
│   │   ├── Resource/
│   │   │   └── PostResource.php
│   │   └── Grid/
│   │       └── PostGrid.php
│   └── Symfony/
│       └── Menu/
│           └── PostMenuContributor.php