/**
  * Transforms an object (access code) to a string.
  *
  * @param  StudentAccessCode|null $code
  * @return string
  */
 public function transform($code)
 {
     if (null === $code) {
         return '';
     }
     return $code->getCode();
 }
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     // Generate 20 access codes
     $faker = new Generator();
     $faker->addProvider(new Base($faker));
     for ($i = 0; $i < 20; $i++) {
         $code = new StudentAccessCode();
         $code->setCode($faker->randomNumber(8));
         $manager->persist($code);
     }
     $manager->flush();
 }