PHP code example of idct / symfony-form-soft-delete-aware-entity-type-ux-autocomplete

1. Go to this page and download the library: Download idct/symfony-form-soft-delete-aware-entity-type-ux-autocomplete 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/ */

    

idct / symfony-form-soft-delete-aware-entity-type-ux-autocomplete example snippets




declare(strict_types=1);

namespace App\Form;

use App\Entity\DeletableEntity;
use IDCT\SymfonyFormSoftDeleteAwareEntityType\Ux\BaseSoftDeleteEntityAutocompleteType;
use Praetorian\Sportsbook\Orm\Entity\Currency;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField;

#[AsEntityAutocompleteField]
class EntityWithDeletableRelationAutocompleteType extends AbstractType
{
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'class' => DeletableEntity::class,
            'placeholder' => 'placeholder',
            'choice_label' => 'name'
        ]);
    }

    public function getParent(): string
    {
        return BaseSoftDeleteEntityAutocompleteType::class;
    }
}