Skip to content
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

Added a doctrine orm query function for phone number #139

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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