misd-service-development / phone-number-bundle Goto Github PK
View Code? Open in Web Editor NEWIntegrates libphonenumber into your Symfony2-Symfony4 application
Integrates libphonenumber into your Symfony2-Symfony4 application
Hello,
What is the current status of this bundle ? Is it still maintained ?
No commit since May and many PR are opened...
Currently the PhoneNumberHandler
only handles E.164 format numbers; the format and default region could be added as options similar to DateTime<'format', 'zone'>
(so the annotation would look something like @Type("libphonenumber\PhoneNumber<'NATIONAL', 'GB'>")
) for flexibility (especially when consuming external feeds).
I am not getting it from the documentation written, if i want to detect is it's a valid phone no (landline + mobile). I don't care if it belongs to any county. I just need to detect if it's a no or not as simple as that.
Please clarify the doubt.
I'm displaying form without labels, but using placeholder has labels.
I have been trying to search and use different method to put placeholder for phone, but it puts it on div element and not the input. How can I put placeholder on input field of phone number?
Hi,
I have a phone_number in my entity, which can be null :
* @ORM\Column (type="phone_number", nullable=true)
But when I try to display a user whose phnone_number is null, I get the following exception :
NumberParseException: The string supplied did not seem to be a phone number.
at PhoneNumberUtil ->parseHelper ('', 'ZZ', false, true, object(PhoneNumber))
in /vendor/giggsey/libphonenumber-for-php/src/libphonenumber/PhoneNumberUtil.php at line 2618
at PhoneNumberUtil ->parse ('', 'ZZ')
Is there a way to allow for null values and avoid this issue ?
Thanks
Regards
It would be useful to implement Symfony\Component\Form\FormTypeGuesserInterface
to guess the tel
form type.
It could check:
@var
doc (based on the example code)Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser
)Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser
)Hi thank for this bundle, how is going to be userfull for me to!
i have just install lake description, and i get : Could not convert database value "" to Doctrine Type phone_number
here my config :
doctrine:
dbal:
types:
phone_number: Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType
in builder form :
use libphonenumber\PhoneNumberFormat;
...........................
->add ( 'phoneNumber', 'tel', array(
'default_region' => 'GB',
'format' => PhoneNumberFormat::NATIONAL)
)
twig :
...........
{{ form(edit_form) }}
...........
entity :
/**
* @ORM\Column(type="phone_number")
*/
private $phoneNumber;
can you help me ?
thank
#15 fixed problems with translations of the validation constraint. All we need now is translation files! Please take a look at the list of currently available ones, and if you're able to speak a language that isn't available (or know of a localisation difference), please open a pull request to add it in. ๐
I'm planning to release v1.1.0 in a few weeks which will include the change, and it would be nice to have as many translations as possible by then.
So I would like to know if there's a way to transform PhoneNumber to string with prefix, for example
+34600000000 for Spain, because when using a PhoneNumber inside query it's not returning anything because MySQL has +34600000000
and PhoneNumber doesn't add the +34 prefix in any way (not even getNationalNumber) so it is useless...
I know that you can instance the utils, parse/transform etc but man, there should be just a one liner way to do it inside the class itself.
Something like this inside PhoneNumber
class
public function getStringNumber() { return sprintf("+%d%d", $this->getCountryCode(), $this->getNationalNumber()); }
So easy...
Services like the geocoder need to be added to the bundle. Care needs to be taken for any that have appeared in more recent versions.
If I have a field like:
$form->add('with', 'tel', array('constraints' => new PhoneNumber(), 'default_region' => 'GB', 'format' => PhoneNumberFormat::NATIONAL));
If I enter +1 650-253-0000
it's accepted; it's then formatted nationally, turning it into (650) 253-0000
. Submitting the form again then leads to a This value is not a valid phone number
and the value is then 6502530000
as it's not recognised as a GB number.
To resolve this, if format is set to national it will need to format numbers that aren't from the default region differently (so it would need something like an international_format
setting).
Hello,
currently you are using addViolation
in your https://github.com/misd-service-development/phone-number-bundle/blob/master/Validator/Constraints/PhoneNumberValidator.php#L98
So there is no option to set an atPath
where to display the message! you not even use addViolationAt
However, addViolation
and addViolationAt
are deprecated from symfony 2.5 and will be removed at 3.0. You should use buildViolation()
instead.
http://symfony.com/doc/current/cookbook/validation/custom_constraint.html#creating-the-validator-itself
You can do something like this:
in Validator/Constraints/PhoneNumber.php
class PhoneNumber extends Constraint
{
public $message = 'This value is not a valid {{ type }} number.';
public $type = 'phone';
public $defaultRegion = PhoneNumberUtil::UNKNOWN_REGION;
public $atPath = 'anyProperty';
}
in Validator/Constraints/PhoneNumberValidator.php
instead of
private function addViolation($value, Constraint $constraint)
{
$this->context->addViolation(
$constraint->message,
array('{{ type }}' => $constraint->type, '{{ value }}' => $value)
);
}
you can use the new function
private function addViolation($value, Constraint $constraint)
{
$this->context->buildViolation($constraint->message)
->atPath($constraint->atPath)
->setParameter('{{ type }}', $constraint->type)
->addViolation();
}
or instead of directly accessing the $constraint properties (e.g. $constraint->atPath) use
a function (saw now that you already did it with getter functions)
public function getAtPath()
With this changes you are save for the future (symfony 3.0+) and you give an option to set the atPath property, so the user can determine where the violation message should appear.
It seems I'm forced to set a default region in order to get phone numbers to persist.
However, if I set my form builder element with a default_region => 'US', format=> PhoneNumberFormat::INTERNATIONAL I'm not allowed to enter and save international phone numbers. e.g. it'll take: 800-800-2775 (US phone number) but not: 0451 029 226 (an Australian phone number). So is it expected that I have to fall into one region with this bundle or have I missed something? My specific application needs to accept phone numbers from around the globe.
Thanks!
Is it possible to mix field type declaration and phone number validation? Basically I want to only accept US mobile phone numbers, but the following code doesn't seem to be working.
/**
* @var PhoneNumber
*
* @Assert\NotBlank(groups={"registration", "profile"})
* @AssertPhoneNumber(
* defaultRegion="US",
* type=AssertPhoneNumber::MOBILE,
* message="This is not a valid mobile phone number.",
* groups={"registration", "profile"}
* )
* @ORM\Column(name="phone_number", type="phone_number", unique=true)
* @Serializer\Expose()
* @Serializer\Type("libphonenumber\PhoneNumber")
*/
private $phoneNumber;
Even though the user enters a valid phone number I would like to reject it if it's not a mobile phone number. Can I do this by simply adding annotations like above?
I defined a Doctrine entity called Phone
like so:
<?php
namespace ACC\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber as AssertPhoneNumber;
use libphonenumber\PhoneNumber as PNum;
/**
* Phone
*
* @ORM\Table(name="phone")
* @ORM\Entity
*/
class Phone
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="phonenumber", type="phone_number")
* @AssertPhoneNumber(defaultRegion="CA")
*/
private $phonenumber;
/**
* @var string
*
* @ORM\Column(name="locale", type="string", length=2)
*/
private $locale = 'CA';
//the usual getters and setters
}
The SQL Create table:
CREATE TABLE `phone` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`phonenumber` varchar(35) COLLATE utf8_unicode_ci NOT NULL COMMENT '(DC2Type:phone_number)',
`locale` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci$$
(an aside, but note that the phonenumber field is varchar(35) and not varchar(20) as stated in the docs)
In the controller I do this:
$em = $this->getDoctrine()->getRepository('ACC\MainBundle\Entity\Phone');
$phone = $em->find(1);
which throws a NumberParseException
: Missing or invalid default region.
How can I identify to Doctrine that it should use my locale
property as the region?
Add these missing phonenumber types to /Validator/Constraints/PhoneNumber.php
FIXED_LINE_OR_MOBILE (edit: doesn't make sense.)
PAGER
PERSONAL_NUMBER
PREMIUM_RATE
SHARED_COST
TOLL_FREE
UAN
VOIP
Source of all types: https://libphonenumber.googlecode.com/svn/trunk/javadoc/com/google/i18n/phonenumbers/PhoneNumberUtil.PhoneNumberType.html
Edit: Known issue in Doctrine2: doctrine/orm#4911
I have this code in my entity:
/**
* @var PhoneNumber
*
* @ORM\Column(type="phone_number")
*/
private $number;
Currently doctrine generates this:
/**
* Set number
*
* @param phone_number $number
*
* @return ContactPhone
*/
public function setNumber($number)
{
$this->number = $number;
return $this;
}
/**
* Get number
*
* @return phone_number
*/
public function getNumber()
{
return $this->number;
}
As you can see the phpdoc is wrong. It should not be phone_number
.
Instead \libphonenumber\PhoneNumber
would be right.
Does anybody have an idea how to fix that? It also works with datetime
=> \DateTime
. Why and how?
Adding a E164 format restriction option to constraint.
An example could be to pull data from records in order to send sms messages.
It seems that the validator refuse to validate mobile phones that begin with 07 in france.
In france, mobile phones begin with 06 or 07.
So when using mapping like in the docs, and telling my field to be a phone_number
type, I get this error
Expected AppBundle\Entity\phone_number got \libphonenumber\PhoneNumber
when calling $entity->setPhone($phone);
this is how I create my $phone
$phone = $container->get('libphonenumber.phone_number_util')->parse($string, PhoneNumberUtil::UNKNOWN_REGION);
for example.
Needless to say that this constant warnings makes all my code "non ok" at the eyes of the IDE, and sometimes is a mess because you forgot about this bug...
I'm using the FOSUserBundle with a Doctrine User entity.
I added the "phone_number" type.
/**
* @var string
*
* @ORM\Column(type="phone_number")
* @AssertPhoneNumber(defaultRegion="US")
*/
protected $telephone;
But now every time I try to load the user from the UserManager or regular Doctrine repositories, I get the error "Missing or invalid default region."
This seems to be caused from re-hydrating the objects and converting the data from the DB. In Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType::convertToPHPValue :
/**
* {@inheritdoc}
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value) {
return null;
}
$util = PhoneNumberUtil::getInstance();
return $util->parse($value, PhoneNumberUtil::UNKNOWN_REGION);
}
I see no way to set the Region? Doesn't there need to be a way to set that as libphonenumber::PhoneNumberUtil won't work with region set to PhoneNumberUtil::UNKNOWN_REGION?
Maybe the region should be a bundle configuration?
I'm sure I'm missing something simple and any help would be appreciated. Thanks!
Hello,
I was trying to use phone number validation in a bundle validation.yml file, but got an exception says default options is not configured.
There is any way to validate entity with yaml file or I'm doing something wrong?
Exception Message
No default option is configured for constraint Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber
validation.yml
UserBundle\Entity\User:
constraints:
- Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber: PhoneNumber
properties:
name:
- NotBlank: ~
surname:
- NotBlank: ~
mobile:
- PhoneNumber: ~
Hi,
In my use case, users can be from many country and each country may have its own phone number format. How I can pass "defaultRegion" dynamically based upon user's country?
I have asset validation on the entity type as following
@AssertPhoneNumber(type="mobile", defaultRegion="GB", groups={"settingsProfile"})
This works prefectly.
Now I want to override this validation on different form. I want to validate phone and mobile, if its coming from uniqe form.
So I wanted to add validation on the form, but not sure how I can do with this plugin.
If I have a Country Widget in my form, how can I remove phone number from my profile?
There is no option to have an empty value in the country field(!), therefore it is impossible to properly remove the phone number from the entity
Add support for Doctrine ODM
Have a repository method that takes the PhoneNumber object as an argument. I have my dql query written as:
->createQuery(
'SELECT p, m FROM AppBundle:Phone p JOIN p.member m WHERE p.phoneNumber = :phone AND m.allowFind = TRUE'
)
->setParameter("phone", $phone)
->getOneOrNullResult();
However when it generates the query it puts 'Object(libphonenumber\PhoneNumber)'
where I would expect it to actually put the Phone Number in the format +1##########
When I use the default findOneByPhoneNumber($phone) it generates the query fine.
Hi,
I couldn't find it in the docs: How do I display the country code and identification in the drop down when choosing a widget 'country_choice' ?
I know this could be changed in the Misd\PhoneNumberBundle\Form\Type\PhoneNumberType
at line 68 as follow:
foreach (Intl::getRegionBundle()->getCountryNames() as $region => $name) {
if (false === isset($countries[$region])) {
continue;
}
$countryChoices[sprintf('%s (+%s)', $region, $countries[$region])] = $region;
}
But I was wondering if there isn't a cleaner way to do this
~thoroc
show
+373 681 11 111
must be
+373 68 111 111
Hello:
Very good bundle. Thanks for your work.
The home page for project libphonenumber at code.google.com lists giggsey/libphonenumber-php and not procto/libphonenumber which is what this bundle is based one.
Is there any specific reason why procto/libphonenumber-for-php was chosen? Both repositories are a fork from the same same repository.
I camr across this bundle and I am trying to integrate it into my application. I have followed all the notations and the database was created as mentioned in the documentation.
My environment is PHP 7 and Symfony 3.
However, I encountered a couple of issues.
An exception has been thrown during the rendering of a template ("Notice: Array to string conversion") in form_div_layout.html.twig at line 13.
This line works.
->add('landlineNo', PhoneNumberType::class, array('default_region' => 'GB', 'format' => PhoneNumberFormat::NATIONAL))
This line doesn't.
->add('landlineNo', PhoneNumberType::class, array('widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE, 'country_choices' => array('GB', 'JE', 'FR', 'US'), 'preferred_country_choices' => array('GB', 'JE')))
Is there any suggestion on how to resolve this so I can use the Country dropdown? Or do I need to append the country code manually?
Would really appreciate a fix since I am trying to get this form done and phone number is the only one pending.
I am trying to get the fields to be optional instead of mandatory (most people won't fill both Landline and Mobile). However, even if I set the field to be optional, the form isValid() fails because of this field.
Kindly assist in figuring out how to make it optional. I don't have any of my own validator configured. So it is basically what Symfony validators are working with.
My class field variable below. As you can see, nullable=true so database can accept null value.
* @var \libphonenumber\PhoneNumber
*
* @Type("libphonenumber\PhoneNumber")
*
* @ORM\Column(name="landline_no", type="phone_number", nullable=true)
*/
private $landlineNo;
My Type for the field. I have set required => false.
->add('landlineNo', PhoneNumberType::class, array( 'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE, 'preferred_country_choices' => array("GB", "US", "AU"), 'label' => "Landline No", 'required' => false, ) )
But when I submit the form, it is returning back as invalid because of the missing value.
Would appreciate the guidance to get this done right.
will be bundle supporting Symfony2 v2.6 ?
./bin/console doctrine:schema:update --force
showing me
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Symfony\Component\Validator\Constraints\PhoneNumber" in property Doma\Bundle\CompanyBundle\Entity\Company::$phoneNumber does not exist, or could not be auto-loaded.
Currently the Twig extension provides a function called phone_number_format
that serves the purpose of formatting a given phone number. I think that a filter would be more appropriate in this case. There are already many bundles that provides filters to format numbers and dates, so why should this bundle provide a function? I prepared a PR with unit tests to handle this issue without breaking BC. I even refactored a bit the code of the classes by removing some namespace imports were not needed
The Travis CI should always check against multiple Symfony versions. Currently it only check against the newest version.
I think we should check it against Symfony 2.3 (LTS) and Symfony 2.8 (LTS). Symfony 3.0 could be added once the compatibility of Symfony 3 has been merged into the master
branch.
I see you have details on how to access and output a phone number in a template file, but when I have the column from the Entity that is a "phone_number" type, I cannot see how to convert this to a string within the controller. It just returns a phone_number object which is not displayable.
I need to do this to return json output from the controller.
Thanks for your help!
Based on a valid phone number in the US, I can provide a number like 123-456-7890 ext 1234567. It seems the phone number is invalid when there's an 8 digit extension. However, the point is this value is stored as +11234567890 ext. 1234567 which is 25 characters. The current doctrine type is set to 20.
Your documentation example for parsing a string is wrong.
Warning: Missing argument 2 for libphonenumber\PhoneNumberUtil::parse()
Because the function parse() needs a second argument ($defaultRegion):
public function parse($numberToParse, $defaultRegion, PhoneNumber $phoneNumber = null, $keepRawInput = false)
I can't find 'WIDGET_COUNTRY_CHOICE' at all. following error I get.
Error: Undefined class constant 'WIDGET_COUNTRY_CHOICE'
use libphonenumber\PhoneNumberFormat;
use Misd\PhoneNumberBundle\Form\Type\PhoneNumberType;
use Symfony\Component\Form\FormBuilderInterface;
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('phone_number', 'tel', array('widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE, 'country_choices' => array('GB', 'JE', 'FR', 'US'), 'preferred_country_choices' => array('GB', 'JE')));
}
Hello, can you please make the addViolation
method protected
instead of private
, so we can overwrite it and set our own location where to display the violation-message (e.g. with addViolationAt). Would be nice, thx!
That would make many lives tons easier for sites which use different CSS styling of prefix element which, dependently on certain site's target audience, is pretty much static.
For example, a simple Twitter Bootstrap form prefix/prepend usage for Nigerian market:
<div class="field col-xs-12 col-sm-12 col-md-4">
<div class="form-group{% if form.phone.vars.errors|length %} has-error{% endif %}">
{{ form_label(form.phone) }}
<div class="input-group">
<span class="input-group-addon">+234</span>
{{ form_widget(form.phone) }}
</div>
{{ form_errors(form.phone) }}
</div>
</div>
This will give +234 +234 %phone-number% unless uber hacking is applied (which then destroys the data format)...
Hello
My name is Andrey. I use FOSUserBundle for my project.
I need users to login via phone_number ONLY.
So I use you bundle. Its great!
add provider in security.yml
providers:
fos_userbundle:
#id: fos_user.user_provider.username
id: equils_user.user_provider.phone
add in services.yml
equils_user.user_provider.phone:
class: Equils\UserBundle\Security\PhoneUserProvider
arguments: [@equils_user.user_manager.default]
equils_user.user_manager.default:
class: Equils\UserBundle\Doctrine\UserManager
arguments:
- @security.encoder_factory
- @fos_user.util.username_canonicalizer
- @fos_user.util.email_canonicalizer
- @fos_user.entity_manager
- %fos_user.model.user.class%
add classes
/**
*/
namespace Equils\UserBundle\Security;
use FOS\UserBundle\Security\UserProvider as BaseProvider;
use FOS\UserBundle\Model\UserManagerInterface;
class PhoneUserProvider extends BaseProvider
{
/**
* @var UserManagerInterface
*/
protected $userManager;
/**
* Constructor.
*
* @param UserManagerInterface $userManager
*/
public function __construct(UserManagerInterface $userManager)
{
$this->userManager = $userManager;
}
/**
* Finds a user by phone number.
*
* @param string $phone
*
* @return UserInterface|null
*/
protected function findUser($phone)
{
return $this->userManager->findUserByPhoneNumber($phone);
}
}
/**
*/
namespace Equils\UserBundle\Doctrine;
use Doctrine\Common\Persistence\ObjectManager;
use FOS\UserBundle\Util\CanonicalizerInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use FOS\UserBundle\Doctrine\UserManager as BaseManager;
class UserManager extends BaseManager
{
public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, ObjectManager $om, $class)
{
parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer, $om, $class);
}
/**
* Finds a user by phone number
*
* @param string $phone
*
* @return UserInterface
*/
public function findUserByPhoneNumber($phone)
{
return $this->findUserBy(array('phone_number' => $phone));
}
}
and so on... but
when I try to log in I get error:
I found place in code where I guess error happen and fix that...
/**
* {@inheritdoc}
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if (null === $value) {
return null;
}
$phoneNumber = PhoneNumberUtil::getInstance()->parse($value, 'RU');
$util = PhoneNumberUtil::getInstance();
return $util->format($phoneNumber, PhoneNumberFormat::E164);
}
Please tell me, what do you think about this fix. Is it valid ?
Entity entries:
/**
* @Orm\Column(type="phone_number", nullable=true)
* @AssertPhoneNumber(defaultRegion="US", message="Please specify a valid phone number")
*/
private $phoneNumber;
DBAL Mapping:
doctrine:
dbal:
types:
phone_number: Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType
Form:
->add('phoneNumber', PhoneNumberType::class, array('default_region' => 'US', 'format' => PhoneNumberFormat::NATIONAL, 'required' => false))
But still I get the below error, Can someone let me know how to resolve this? I wrote few lines of code to convert the string to PhoneNumber obj then the form loads fine but my question is do we need to explicitly convert this? Is this not to be handled automatically?
if($user->getphoneNumber()!="") {
$util = $this->container->get('libphonenumber.phone_number_util');
$phoneNUmber = $util->parse($user->getphoneNumber(), "US"); $user->setphoneNumber($phoneNUmber);
} else {
$phoneNUmber = new \libphonenumber\PhoneNumber;
$user->setphoneNumber($phoneNUmber);
}
Uncaught PHP Exception Symfony\Component\Form\Exception\TransformationFailedException: "Unable to transform value for property path "phone_number": Expected a \libphonenumber\PhoneNumber." at /var/www/example/webapp/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php line 1149 {"exception":"[object] (Symfony\Component\Form\Exception\TransformationFailedException(code: 0): Unable to transform value for property path "phone_number": Expected a \libphonenumber\PhoneNumber. at /var/www/example/webapp/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:1149, Symfony\Component\Form\Exception\TransformationFailedException(code: 0): Expected a \libphonenumber\PhoneNumber. at /var/www/example/webapp/vendor/misd/phone-number-bundle/Form/DataTransformer/PhoneNumberToStringTransformer.php:62)
The content format is xliff and the extension is yaml, wich trigger this exception:
[Symfony\Component\Translation\Exception\InvalidResourceException]
Error parsing YAML, invalid file "<rootPath>/vendor/misd/phone-number-bundle/Resources/translations/validators.fi.yml"
related with merged pull request #93
The README file is quite long now, which isn't great for reading (refs #42). The usage part should be broken up into separate files.
I'm using the PhoneNumberBundle with Doctrine, I have this field:
/**
* @ORM\Column(type="phone_number", nullable=true)
* @Serializer\Type("libphonenumber\PhoneNumber")
* @AssertPhoneNumber(defaultRegion="US")
*/
protected $phoneNumber;
The validation is ok, but when I persist the object I get this error:
Catchable Fatal Error: Argument 1 passed to libphonenumber\PhoneNumberUtil::format() must be an instance of libphonenumber\PhoneNumber, string given, called in /miproject/vendor/misd/phone-number-bundle/Misd/PhoneNumberBundle/Doctrine/DBAL/Types/PhoneNumberType.php on line 58 and defined in /myproject/vendor/giggsey/libphonenumber-for-php/src/libphonenumber/PhoneNumberUtil.php line 992
I debugged the code and I saw that in class PhoneNumberType, the function convertToDatabaseValue receives the string and not the libphonenumber\PhoneNumber object...
Should I parse and create the libphonenumber\PhoneNumber before persist the object?
Thanks!
Please add support for symfony3
Please add a PhoneNumberTypeExtension for Twig to show the type of a number.
The form/validation messages should have translations, currently only English is available.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.