2016-03-29 06:53:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Skobkin\Bundle\PointToolsBundle\DataFixtures\ORM;
|
|
|
|
|
|
|
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
|
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
|
|
|
use Doctrine\Common\Persistence\ObjectManager;
|
|
|
|
use Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Post;
|
|
|
|
use Skobkin\Bundle\PointToolsBundle\Entity\User;
|
|
|
|
|
|
|
|
class LoadPostData extends AbstractFixture implements OrderedFixtureInterface
|
|
|
|
{
|
|
|
|
public function load(ObjectManager $om)
|
|
|
|
{
|
2016-12-11 22:53:56 +00:00
|
|
|
/** @var User $testUser */
|
|
|
|
$testUser = $this->getReference('test_user_99999');
|
2016-03-29 06:53:06 +00:00
|
|
|
|
2016-12-11 22:53:56 +00:00
|
|
|
$post = (new Post('longpost'))
|
|
|
|
->setAuthor($testUser)
|
2016-03-29 06:53:06 +00:00
|
|
|
->setCreatedAt(new \DateTime())
|
|
|
|
->setText('Test post with many comments')
|
|
|
|
->setPrivate(false)
|
|
|
|
->setType(Post::TYPE_POST)
|
|
|
|
->setDeleted(false)
|
|
|
|
;
|
|
|
|
|
|
|
|
$om->persist($post);
|
|
|
|
$om->flush();
|
|
|
|
|
2016-12-11 22:53:56 +00:00
|
|
|
$this->addReference('test_post_longpost', $post);
|
2016-03-29 06:53:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getOrder()
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|