[Flow] Problem to follow the "Definitive Guide"

Jonas Schmidt jonas.a.schmidt at arcor.de
Sun Apr 26 17:37:25 CEST 2015


Hello,

I tried to follow the "The Definitve Guide" to do my fist steps with flow. I came to Part II Chapter "Controller / Basic Post Controller".

After I run dev.tutorial.local/typo3.blog/post I got the following PHP-Error:

PHP Fatal error:  Call to a member function getTitle() on a non-object in /root/Flow3/tutorial/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Blog_Controller_PostController.php on line 29

This is the function:

public function indexAction() {
                $blog = $this->blogRepository->findActive();
                $output = '
                        <h1>Posts of "' . $blog->getTitle() . '"</h1>
                        <ol>';

                foreach ($blog->getPosts() as $post) {
                        $output .= '<li>' . $post->getTitle() . '</li>';
                }

                $output .= '</ol>';

                return $output;
}

It seems, that blog created in the SetupController is not stored in the blogRepository. I modified SetupController.php to test this:

       public function indexAction() {
                $this->blogRepository->removeAll();
                $this->postRepository->removeAll();

                $blog = new \TYPO3\Blog\Domain\Model\Blog();
                $blog->setTitle('My Blog');
                $blog->setDescription('A blog about Foo, Bar and Baz.');
                $this->blogRepository->add($blog);

                $post = new \TYPO3\Blog\Domain\Model\Post();
                $post->setAuthor('John Doe');
                $post->setTitle('Example Post');
                $post->setContent('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
                $this->postRepository->add($post);

                $blog->addPost($post);
                
        
                //*** Test Begin ***
                
                $blog2 = $this->blogRepository->findActive();
                if ($blog2 == NULL)
		  return "Blog not created";
                
                //*** Test End ****

                return 'Successfully created a blog';
        }

(The Code between Test Begin and Test End is from me)

After I run  dev.tutorial.local/typo3.blog/setup/index I got the message "Blog not created"

I have tried the tutorial twice and stumbled back to the same error. Can someone help me? 

Greetings
Jonas


More information about the Flow mailing list