定制 nepada/phone-number-doctrine 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nepada/phone-number-doctrine

最新稳定版本:v2.3.3

Composer 安装命令:

composer require nepada/phone-number-doctrine

包简介

Phone number type for Doctrine.

README 文档

README

Build Status Coverage Status Downloads this Month Latest stable

Installation

Via Composer:

$ composer require nepada/phone-number-doctrine

Register the type in your bootstrap:

\Doctrine\DBAL\Types\Type::addType(
    \Brick\PhoneNumber\PhoneNumber::class,
    \Nepada\PhoneNumberDoctrine\PhoneNumberType::class
);

In Nette with nettrine/dbal integration, you can register the types in your configuration:

dbal:
    connection:
        types:
            Brick\PhoneNumber\PhoneNumber: Nepada\PhoneNumberDoctrine\PhoneNumberType

Usage

PhoneNumberType maps database value to phone number value object (see brick/phonenumber for further details) and back. The phone number is stored using E164 format, i.e. a '+' sign followed by a series of digits comprising the country code and national number.

Example usage in the entity:

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Brick\PhoneNumber\PhoneNumber;

#[Entity]
class Contact
{

    #[Column(type: PhoneNumber::class, nullable: false)]
    private PhoneNumber $phoneNumber;

    public function getPhoneNumber(): PhoneNumber
    {
        return $this->phoneNumber;
    }

}

Example usage in query builder:

$result = $repository->createQueryBuilder('foo')
    ->select('foo')
    ->where('foo.phoneNumber = :phoneNumber')
     // the parameter value is automatically normalized to +420123456789
    ->setParameter('phoneNumber', '+420 123 456 789', \Brick\PhoneNumber\PhoneNumber::class)
    ->getQuery()
    ->getResult();

统计信息

  • 总下载量: 36.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-06-09