代码区项目交易流程

New in Symfony 4.3: Improved Financial Constraints


The International Bank Account Number (IBAN) is an internationally agreed system of identifying bank accounts across national borders. The Bank Identifier Code (BIC) is a unique identification code for both financial and non-financial institutions defined in the ISO 9362 standard .

Although both codes are independent, they can be checked in combination to validate that both belong at least to the same country. In Symfony 4.3 we improved theBic constraint to allow validating BIC and IBAN codes together.

First, you can pass the IBAN code using the new iban option:

use Symfony\Component\Validator\Constraints as Assert; // ... public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addPropertyConstraint('businessIdentifierCode', new Assert\Bic([ 'iban' => 'FR1420041010050500013M02606', )]); }

You can also use the new ibanPropertyPath option to define the object property that stores the IBAN code:

use Symfony\Component\Validator\Constraints as Assert; // ... class Transaction { /** * @Assert\Bic(ibanPropertyPath = "accountNumber") */ protected $businessIdentifierCode; /** * @Assert\Iban */ protected $accountNumber; // ... }

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

点击收藏

LAST 从PHP的入门到踩坑 Building and Testing RESTful APIs With Laravel NEXT