Open
Description
Hello after installing the perfect bundle for the task I want to do. I get this error. Could not convert database value "" to Doctrine Type phone_number
I searched a bit and came across this discussion: https://github.com/misd-service-development/phone-number-bundle/issues/58
But this didn't solve my problem, can you help me?
thank
doctrine:
dbal:
types:
phone_number: Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType
in builder form :
use libphonenumber\PhoneNumberFormat;
use Misd\PhoneNumberBundle\Form\Type\PhoneNumberType;
................................................................................................
->add('phone', PhoneNumberType::class, [
'format' => PhoneNumberFormat::INTERNATIONAL,
'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE,
'country_display_emoji_flag' => true,
'country_placeholder' => $this->translate->trans('Choisisez l\'indicatif', domain: 'security'),
'label' => $this->translate->trans("Téléphone portable", domain: 'security'),
'row_attr' => ['class' => 'input-group mb-3'],
'country_options' => [
'autocomplete' => true,
],
]);
twig :
{{ form_start(form) }}
{{ form_row(form.firstname) }}
{{ form_row(form.lastname) }}
{{ form_row(form.phone) }}
<button class="btn btn-primary w-100 py-2" type="submit">{% trans %}Sauvegarder{% endtrans %}</button>
{{ form_end(form) }}
entity :
#[PhoneNumber(regionPath: 'countryPhone', format: PhoneNumberFormat::INTERNATIONAL, type: PhoneNumber::MOBILE)]
#[ORM\Column(length: 35, nullable: true, type: PhoneNumberType::NAME)]
private ?string $phone = null;
Metadata
Metadata
Assignees
Labels
No labels