Skip to content

Instantly share code, notes, and snippets.

View EuphoryX1's full-sized avatar

TAKANO,Noriyuki EuphoryX1

  • Tokyo,JAPAN
View GitHub Profile
@EuphoryX1
EuphoryX1 / symfony2_validation_callback_constraint
Last active December 12, 2015 02:08 — forked from anonymous/symfony2_validation_callback_constraint
Callback制約を使って2つのフォームプロパティを参照してバリデーションを実施する。Callback制約をどのフォームに適用するかを指定するために、groupsの指定が必要
・validation.ymlに
constraints:
- Callback:
methods: [isEmailConfirmEqual]
groups: [registration]
・フォームエンティティクラスに
public function isEmailConfirmEqual(ExecutionContext $context)
{
if ($this->email != $this->email_confirm) {