Replace the old HookableComponentTrait with the new HookableLiveComponentTrait

This commit is contained in:
Jacob Tobiasz 2024-04-29 12:14:23 +02:00
parent 563b1db139
commit 5db9ca8aef
No known key found for this signature in database
GPG key ID: 3F84290201B006E0
13 changed files with 22 additions and 77 deletions

View file

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\Twig\Component\CatalogPromotion;
use Sylius\Component\Core\Model\CatalogPromotion;
use Sylius\TwigHooks\Twig\Component\HookableComponentTrait;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
@ -29,7 +29,7 @@ use Symfony\UX\LiveComponent\LiveCollectionTrait;
class FormComponent
{
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
use LiveCollectionTrait;
#[LiveProp(fieldName: 'resource')]

View file

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\Twig\Component\Channel;
use Sylius\Component\Core\Model\Channel;
use Sylius\TwigHooks\Twig\Component\HookableComponentTrait;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
@ -26,7 +26,7 @@ use Symfony\UX\LiveComponent\DefaultActionTrait;
final class FormComponent
{
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
use ComponentWithFormTrait;
#[LiveProp(fieldName: 'formData')]

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\Twig\Component\Product;
use Sylius\Bundle\AdminBundle\TwigComponent\HookableComponentTrait;
use Sylius\Component\Core\Model\Product;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
@ -26,7 +26,7 @@ use Symfony\UX\LiveComponent\LiveCollectionTrait;
final class GenerateProductVariantsFormComponent
{
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
use LiveCollectionTrait;
#[LiveProp(fieldName: 'resource')]

View file

@ -13,11 +13,11 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\TwigComponent\Customer;
use Sylius\Bundle\AdminBundle\TwigComponent\HookableComponentTrait;
use Sylius\Component\Core\Customer\Statistics\CustomerStatisticsProviderInterface;
use Sylius\Component\Core\Customer\Statistics\PerChannelCustomerStatistics;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Repository\CustomerRepositoryInterface;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\LiveComponent\DefaultActionTrait;
@ -29,7 +29,7 @@ use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate;
)]
final class OrderStatistics
{
use HookableComponentTrait;
use HookableLiveComponentTrait;
use DefaultActionTrait;
#[LiveProp]

View file

@ -16,7 +16,7 @@ namespace Sylius\Bundle\AdminBundle\TwigComponent\Dashboard;
use Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface;
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\TwigHooks\Twig\Component\HookableComponentTrait;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveAction;
use Symfony\UX\LiveComponent\Attribute\LiveArg;
@ -30,7 +30,7 @@ final class StatisticsComponent
{
use ComponentToolsTrait;
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
#[LiveProp]
public string $channelCode;

View file

@ -1,32 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\AdminBundle\TwigComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate;
trait HookableComponentTrait
{
#[LiveProp(fieldName: 'parent_main_hook')]
#[ExposeInTemplate(name: 'parent_main_hook')]
public ?string $parentMainHook = null;
#[LiveProp(fieldName: 'parent_fallback_hook')]
#[ExposeInTemplate(name: 'parent_fallback_hook')]
public ?string $parentFallbackHook = null;
#[LiveProp(fieldName: 'hookable_configuration')]
#[ExposeInTemplate(name: 'hookable_configuration')]
public mixed $hookableConfiguration = null;
}

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\TwigComponent\Order;
use Sylius\Bundle\AdminBundle\TwigComponent\HookableComponentTrait;
use Sylius\Component\Core\Model\Order;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
@ -27,7 +27,7 @@ final class OrderType
{
use ComponentWithFormTrait;
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
#[LiveProp]
public ?Order $order = null;

View file

@ -13,13 +13,13 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\TwigComponent\Product;
use Sylius\Bundle\AdminBundle\TwigComponent\HookableComponentTrait;
use Sylius\Component\Core\Model\Product;
use Sylius\Component\Product\Factory\ProductFactoryInterface;
use Sylius\Component\Product\Generator\SlugGeneratorInterface;
use Sylius\Component\Product\Model\ProductAttributeInterface;
use Sylius\Component\Product\Model\ProductAttributeValueInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
@ -41,7 +41,7 @@ class FormComponent
use ComponentToolsTrait;
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
use LiveCollectionTrait;
#[LiveProp(dehydrateWith: 'dehydrateFormData', fieldName: 'formData')]

View file

@ -13,6 +13,7 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\TwigComponent\Product;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\UX\Autocomplete\Checksum\ChecksumCalculator;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
@ -33,6 +34,7 @@ final class ProductAttributeAutocompleteComponent
use ComponentToolsTrait;
use DefaultActionTrait;
use HookableLiveComponentTrait;
public function __construct(
private readonly ChecksumCalculator $checksumCalculator,

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\TwigComponent\Promotion;
use Sylius\Bundle\AdminBundle\TwigComponent\HookableComponentTrait;
use Sylius\Component\Core\Model\Promotion;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
@ -29,7 +29,7 @@ use Symfony\UX\LiveComponent\LiveCollectionTrait;
final class FormComponent
{
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
use LiveCollectionTrait;
#[LiveProp(fieldName: 'resource')]

View file

@ -13,8 +13,8 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\TwigComponent\Shipment;
use Sylius\Bundle\AdminBundle\TwigComponent\HookableComponentTrait;
use Sylius\Component\Core\Model\Shipment;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
@ -26,7 +26,7 @@ use Symfony\UX\LiveComponent\DefaultActionTrait;
final class ShipType
{
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
use ComponentWithFormTrait;
#[LiveProp]

View file

@ -14,9 +14,9 @@ declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\TwigComponent\Taxon;
use Doctrine\Persistence\ObjectManager;
use Sylius\Bundle\AdminBundle\TwigComponent\HookableComponentTrait;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface;
use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveAction;
use Symfony\UX\LiveComponent\Attribute\LiveArg;
@ -27,7 +27,7 @@ use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate;
final class TaxonTreeComponent
{
use DefaultActionTrait;
use HookableComponentTrait;
use HookableLiveComponentTrait;
/**
* @param TaxonRepositoryInterface<TaxonInterface> $taxonRepository

View file

@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\AdminBundle\TwigComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
trait UiEventsTrait
{
#[LiveProp]
public ?string $mainEvent = null;
#[LiveProp]
public ?string $fallbackEvent = null;
}