-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0 in form number field #174
Comments
Could you provide code from your entity and form type, please? |
@osavchenko yes. Form: ->add('phone', PhoneNumberType::class, [
'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE,
'country_choices' => ['UA'],
'attr' => [
'class' => 'input-group',
],
'constraints' => [
new PhoneValidator(),
],
'country_placeholder' => 'form.join.country_placeholder',
]) Entity: /**
* @var PhoneNumber
* @ORM\Column(type="phone_number", unique=true)
* @Type("libphonenumber\PhoneNumber")
*/
private $phone;
/**
* @return PhoneNumber
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param $rawPhone
*
* @throws \libphonenumber\NumberParseException
*
* @return User
*/
public function setRawPhone(string $rawPhone): self
{
$phoneNumber = PhoneNumberUtil::getInstance()->parse($rawPhone);
$this->phone = $phoneNumber;
return $this;
}
/**
* @param PhoneNumber $phone
*/
public function setPhone(PhoneNumber $phone): self
{
$this->phone = $phone;
return $this;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a problem with form rendering of entity with already defined data. For example in database is entity with phone field +380509882331, but in form i've got (zero in start of number must be a part of country code)
The text was updated successfully, but these errors were encountered: