-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OP-549: Sylius 2 not-complete upgrade
- Loading branch information
Showing
80 changed files
with
1,598 additions
and
718 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/Form/Type/Autocomplete/AbstractCollectionAutocompleteType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Sylius\CmsPlugin\Entity\Collection; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType; | ||
|
||
abstract class AbstractCollectionAutocompleteType extends AbstractType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->setDefaults([ | ||
'class' => Collection::class, | ||
'choice_label' => 'name', | ||
'choice_value' => 'code', | ||
]); | ||
} | ||
|
||
public function getParent(): string | ||
{ | ||
return BaseEntityAutocompleteType::class; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Form/Type/Autocomplete/AbstractMediaAutocompleteType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Sylius\CmsPlugin\Entity\Media; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType; | ||
|
||
abstract class AbstractMediaAutocompleteType extends AbstractType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->setDefaults([ | ||
'class' => Media::class, | ||
'choice_label' => 'name', | ||
'choice_value' => 'code', | ||
]); | ||
} | ||
|
||
public function getParent(): string | ||
{ | ||
return BaseEntityAutocompleteType::class; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Form/Type/Autocomplete/AbstractTemplateAutocompleteType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Sylius\CmsPlugin\Entity\Template; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType; | ||
|
||
abstract class AbstractTemplateAutocompleteType extends AbstractType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->setDefaults([ | ||
'class' => Template::class, | ||
'choice_label' => 'name', | ||
'choice_value' => 'id', | ||
]); | ||
} | ||
|
||
public function getParent(): string | ||
{ | ||
return BaseEntityAutocompleteType::class; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Form/Type/Autocomplete/CollectionPageAutocompleteType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Sylius\CmsPlugin\Repository\CollectionRepositoryInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField; | ||
|
||
#[AsEntityAutocompleteField( | ||
alias: 'sylius_admin_cms_collection_page', | ||
route: 'sylius_admin_entity_autocomplete', | ||
)] | ||
final class CollectionPageAutocompleteType extends AbstractCollectionAutocompleteType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
parent::configureOptions($resolver); | ||
|
||
$resolver->setDefault('query_builder', function (CollectionRepositoryInterface $er) { | ||
$qb = $er->createQueryBuilder('o'); | ||
|
||
$qb->andWhere('o.type = :type') | ||
->setParameter('type', 'page') | ||
; | ||
|
||
return $qb; | ||
}); | ||
} | ||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'sylius_admin_cms_collection_page_autocomplete'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField; | ||
|
||
#[AsEntityAutocompleteField( | ||
alias: 'sylius_admin_cms_media', | ||
route: 'sylius_admin_entity_autocomplete', | ||
)] | ||
final class MediaAutocompleteType extends AbstractMediaAutocompleteType | ||
{ | ||
public function getBlockPrefix(): string | ||
{ | ||
return 'sylius_admin_cms_media_autocomplete'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Sylius\CmsPlugin\Repository\MediaRepositoryInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField; | ||
|
||
#[AsEntityAutocompleteField( | ||
alias: 'sylius_admin_cms_media_image', | ||
route: 'sylius_admin_entity_autocomplete', | ||
)] | ||
final class MediaImageAutocompleteType extends AbstractMediaAutocompleteType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
parent::configureOptions($resolver); | ||
|
||
$resolver->setDefault('query_builder', function (MediaRepositoryInterface $er) { | ||
$qb = $er->createQueryBuilder('o'); | ||
|
||
$qb->andWhere('o.type = :type') | ||
->setParameter('type', 'image') | ||
; | ||
|
||
return $qb; | ||
}); | ||
} | ||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'sylius_admin_cms_media_image_autocomplete'; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Form/Type/Autocomplete/TemplateBlockAutocompleteType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Sylius\CmsPlugin\Repository\TemplateRepositoryInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField; | ||
|
||
#[AsEntityAutocompleteField( | ||
alias: 'sylius_admin_cms_template_block', | ||
route: 'sylius_admin_entity_autocomplete', | ||
)] | ||
final class TemplateBlockAutocompleteType extends AbstractTemplateAutocompleteType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
parent::configureOptions($resolver); | ||
|
||
$resolver->setDefault('query_builder', function (TemplateRepositoryInterface $er) { | ||
$qb = $er->createQueryBuilder('o'); | ||
|
||
$qb->andWhere('o.type = :type') | ||
->setParameter('type', 'block') | ||
; | ||
|
||
return $qb; | ||
}); | ||
} | ||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'sylius_admin_cms_template_block_autocomplete'; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Form/Type/Autocomplete/TemplatePageAutocompleteType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\CmsPlugin\Form\Type\Autocomplete; | ||
|
||
use Sylius\CmsPlugin\Repository\TemplateRepositoryInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField; | ||
|
||
#[AsEntityAutocompleteField( | ||
alias: 'sylius_admin_cms_template_page', | ||
route: 'sylius_admin_entity_autocomplete', | ||
)] | ||
final class TemplatePageAutocompleteType extends AbstractTemplateAutocompleteType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
parent::configureOptions($resolver); | ||
|
||
$resolver->setDefault('query_builder', function (TemplateRepositoryInterface $er) { | ||
$qb = $er->createQueryBuilder('o'); | ||
|
||
$qb->andWhere('o.type = :type') | ||
->setParameter('type', 'page') | ||
; | ||
|
||
return $qb; | ||
}); | ||
} | ||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'sylius_admin_cms_template_page_autocomplete'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.