Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Validator/Initializer.php

39 lines
952 B

<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\UserBundle\Validator;
use FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Model\UserManagerInterface;
use Symfony\Component\Validator\ObjectInitializerInterface;
/**
* Automatically updates the canonical fields before validation.
*
* @author Christophe Coevoet <stof@notk.org>
*/
class Initializer implements ObjectInitializerInterface
{
private $userManager;
public function __construct(UserManagerInterface $userManager)
{
$this->userManager = $userManager;
}
public function initialize($object)
{
if ($object instanceof UserInterface) {
$this->userManager->updateCanonicalFields($object);
}
}
}