AppBundle\Entity\Post::getTitle PHP Method

getTitle() public method

public getTitle ( )
    public function getTitle()
    {
        return $this->title;
    }

Usage Example

Example #1
0
 public function load(ObjectManager $manager)
 {
     // TODO: Implement load() method.
     $category = new Category();
     $category->setName('Default');
     $manager->persist($category);
     foreach (range(1, 100) as $i) {
         $post = new Post();
         $post->setTitle($this->getPostTitle());
         $post->setSlug($this->container->get('slugger')->slugify($post->getTitle()));
         $post->setImage('post.jpeg');
         $post->setContent($this->getPostContent());
         $post->setAuthor('gunyem');
         $post->setCreated(new \DateTime('now - ' . $i . 'days'));
         $post->setUpdated(new \DateTime('now - ' . $i . 'days'));
         $post->setCategory($category);
         foreach (range(1, 10) as $j) {
             $comment = new Comment();
             $comment->setPost($post);
             $comment->setContent($this->getPostTitle());
             $comment->setAuthor('gunyem');
             $comment->setCreated(new \DateTime('now + ' . ($i + $j) . 'seconds'));
             $manager->persist($comment);
             $post->createComment($comment);
         }
         $manager->persist($post);
     }
     $manager->flush();
 }
All Usage Examples Of AppBundle\Entity\Post::getTitle