/**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $users = [$this->getUserReference(Users::USER_1), $this->getUserReference(Users::USER_2)];
     $blogPosts = [];
     for ($i = 0; $i < 40; $i++) {
         $userIdx = $i % 2;
         $user = $users[$userIdx];
         $blogPost = new BlogPost();
         $blogPost->setUuid(sprintf('90900ded-c4ec-4322-9604-04443bc491%02d', $i));
         $blogPost->setAuthor($user);
         $blogPost->setTitle('Title ' . $i);
         $blogPost->setContent('Content ' . $i);
         $blogPosts[] = $blogPost;
         $manager->persist($blogPost);
         if ($i == 0) {
             $manager->flush();
             $this->setReference(self::BLOG_POST_1, $blogPost);
         }
         if ($i == 1) {
             $manager->flush();
             $this->setReference(self::BLOG_POST_2, $blogPost);
         }
     }
     $manager->flush();
 }
 public function getCreatedUpdated()
 {
     $blogPostRepository = $this->getBlogPostRepository();
     /** @var User $user */
     $user = $this->referenceRepository->getReference(Users::USER_1);
     $blogPost = new BlogPost();
     $blogPost->setAuthor($user);
     $blogPost->setTitle('Title');
     $blogPost->setContent('Content');
     /** @var BlogPost $blogPost */
     $blogPost = $blogPostRepository->persist($blogPost);
     $created = $blogPost->getCreated();
     $this->assertNotNull($created);
     $updated = $blogPost->getUpdated();
     $this->assertNotNull($updated);
     $blogPostRepository->detach($blogPost);
     /** @var BlogPost $blogPost */
     $blogPost = $blogPostRepository->find($blogPost->getId());
     $blogPost->setTitle('blablabla');
     $blogPostRepository->flush($blogPost);
     $this->assertEquals($created, $blogPost->getCreated());
     $this->assertTrue($blogPost->getUpdated() > $updated);
 }