<?php

declare(strict_types=1);

/*
 * Chill is a software for social workers
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Chill\MainBundle\DataFixtures\ORM;

use Chill\MainBundle\Entity\UserJob;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;

class LoadUserJob extends AbstractFixture implements OrderedFixtureInterface
{
    final public const USER_JOB = 'user_job';
    private array $socialWorker = ['en' => 'social worker', 'fr' => 'travailleur social'];

    public function getOrder(): int
    {
        return 9000;
    }

    public function load(ObjectManager $manager): void
    {
        $o = new UserJob();
        $o->setLabel($this->socialWorker);

        $manager->persist($o);

        $this->addReference(self::USER_JOB, $o);
        echo "Adding one AccompanyingPeriod User Job\n";

        $manager->flush();
    }
}
