Skip to content

Conversation

@modiamir
Copy link

Added a function to use in doctrine query builder and DQL for making query based on PhoneNumber object like this:

$util = $this->get('libphonenumber.phone_number_util');
$phone = $util->parse('09125995014', 'IR');
        
$qb = $this->getDoctrine()->getRepository('AppBundle:User')
    ->createQueryBuilder('u');

$user = $qb->where($qb->expr()->eq('u.phone', "PHONE($phone)"))
    ->getQuery()
    ->getResult();

To use this DQL function we need to add this to symfony configuration:

doctrine:
    orm:
        dql:
            string_functions:
                PHONE: Misd\PhoneNumberBundle\Doctrine\ORM\DQL\Functions\Phone

@shakaran
Copy link
Contributor

shakaran commented Sep 1, 2017

@modiamir Could you update your PR since the test only fails for HHVM

HHVM is no longer supported on Ubuntu Precise. Please consider using Trusty with dist: trusty.

So @rh389 could check later and merge if all it is ok, thanks!

@modiamir modiamir force-pushed the master branch 2 times, most recently from 71c13c6 to 40fec7a Compare September 2, 2017 04:52
@modiamir
Copy link
Author

modiamir commented Sep 2, 2017

@shakaran i added dist: trusty to .travic-ci.yml, now tests pass for all versions of php

@shakaran
Copy link
Contributor

@modiamir Thanks very much! Now the maintainer could easy merge after his review ;)

@modiamir
Copy link
Author

@rh389 would you please review this pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants