GraphAware\Neo4j\OGM\Tests\Integration\UseCase\SimpleBlog\Model\SimpleBlogUser::createPost PHP Method

createPost() public method

public createPost ( $title )
    public function createPost($title)
    {
        $post = new SimpleBlogPost($title);
        $wroteRel = new SimpleBlogWrote($this, $post);
        $this->posts->add($wroteRel);
        $post->setPublication($wroteRel);
    }

Usage Example

 private function init()
 {
     $this->clearDb();
     $user = new SimpleBlogUser('john');
     $user->createPost('New Blog Post');
     $this->em->persist($user);
     $this->em->flush();
     $this->em->clear();
 }