/**
  * @return \WellCommerce\AppBundle\Entity\ProducerInterface
  */
 public function create()
 {
     $producer = new Producer();
     $producer->setDeliverers(new ArrayCollection());
     $producer->setPhoto(null);
     $producer->setShops(new ArrayCollection());
     return $producer;
 }
 public function testEntityRequiresNonEmptyNameAndSlug()
 {
     $entity = new Producer();
     $entity->translate('en')->setName('');
     $entity->translate('en')->setSlug('');
     $entity->mergeNewTranslations();
     $errors = $this->validator->validate($entity);
     $this->assertEquals(2, count($errors));
 }
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $shop = $this->getReference('shop');
     foreach (self::$samples as $name) {
         $producer = new Producer();
         $producer->addShop($shop);
         $producer->translate('en')->setName($name);
         $producer->translate('en')->setSlug(Sluggable::makeSlug($name));
         $producer->mergeNewTranslations();
         $manager->persist($producer);
         $this->setReference('producer_' . $name, $producer);
     }
     $manager->flush();
 }