<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace App\Form\DataTransformer;

use App\Entity\UtilisateurRole;
use App\Entity\UtilisateurSite;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\DataTransformerInterface;



class UtilisateurSiteTransformer implements DataTransformerInterface
{
    private $entityManager;

    public function __construct(EntityManagerInterface $entityManager)
    {
        $this->entityManager = $entityManager;
    }

    /**
     * Transforms the numeric array (1,2,3,4) to a collection of Categories (Categories[])
     *
     * @param Array|null $utilisateurSite
     * @return array
     */
    public function transform($utilisateursSite): ?array
    {
        $result = null;
        if (null !== $utilisateursSite) {
            foreach ($utilisateursSite as $utilisateurSite) {
               return $utilisateursSite;
            }
        }

       return $result;
    }

    /**
     * In this case, the reverseTransform can be empty.
     *
     * @param type $value
     * @return array
     */
    public function reverseTransform($value): ?array
    {
        return null;
    }
}
