[FLOW3-general] Undefined Property error in Blog example

Stephen Bungert stephenbungert at yahoo.de
Sat Apr 30 19:42:17 CEST 2011


I have got as far with the blog example as here:

http://flow3.typo3.org/documentation/tutorials/getting-started/gettingstarted.controller/

But I get the following error when I go to : 
http://dev.tutorial.local/blog/setup/index

1: Notice: Undefined property: 
F3\Blog\Controller\SetupController::$factoryObject in 
C:\xampp\htdocs\stephen\flow3\Packages\Application\Blog\Classes\Controller\SetupController.php 
line 45

Here is the complete code for the class, does anyone know what the problem 
might be?

<?php
declare(ENCODING = 'utf-8');
namespace F3\Blog\Controller;

/*                                                                        *
 * This script belongs to the FLOW3 package "Blog".                       *
 *                                                                        *
 * It is free software; you can redistribute it and/or modify it under    *
 * the terms of the GNU Lesser General Public License as published by the *
 * Free Software Foundation, either version 3 of the License, or (at your *
 * option) any later version.                                             *
 *                                                                        *
 * This script is distributed in the hope that it will be useful, but     *
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
 * General Public License for more details.                               *
 *                                                                        *
 * You should have received a copy of the GNU Lesser General Public       *
 * License along with the script.                                         *
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
 *                                                                        *
 * The TYPO3 project - inspiring people to share!                         *
 *                                                                        */

/**
 * Setup controller for the Blog package
 *
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public 
License, version 3 or later
 */
class SetupController extends \F3\FLOW3\MVC\Controller\ActionController {
 /**
  * @inject
  * @var \F3\Blog\Domain\Repository\BlogRepository
  */
 protected $blogRepository;

 /**
  * Sets up a fresh blog and creates a sample post.
  *
  * @return void
  */
 public function indexAction() {
  $this->blogRepository->removeAll();

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

  $post = $this->objectFactory->create('F3\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.');

  $blog->addPost($post);

  return 'Successfully created a blog';
 }
}

?>



More information about the FLOW3-general mailing list