/**
  * @Given there are article categories:
  */
 public function thereAreArticleCategories(TableNode $table)
 {
     $em = $this->getContainer()->get('doctrine')->getManager();
     $i = 1;
     foreach ($table->getHash() as $row) {
         $category = new ArticleCategory();
         $category->setName($row['name']);
         $category->setSlug($row['slug']);
         $category->setAbbr('');
         $em->persist($category);
         $em->flush();
         $this->getParameterBag()->set(sprintf('ARTICLE_CATEGORY_%s_ID', $i), $category->getIdArticleCategory());
         $i++;
     }
 }
 public function postArticlecategoriesAction()
 {
     $entityManager = $this->getDoctrine()->getEntityManager();
     $repository = $entityManager->getRepository('AppBundle:ArticleCategory');
     $number = random_int(1, 100);
     $category = new ArticleCategory();
     //        name, slug, abbr, creation_date, modification_date, idx, se, visible, deleted
     $category->setName('Nowa kategoria dla api ' . $number);
     $category->setSlug('nowa-kategoria-dla-api-' . $number);
     $category->setAbbr('nkda' . $number);
     //        $category->setCreationDate();
     $category->setIdx('0');
     $entityManager->persist($category);
     $entityManager->flush();
     $view = $this->view($category, 201);
     return $this->handleView($view);
 }