Permalink
Browse files

Ajout de vues

  • Loading branch information...
1 parent 6d688b1 commit 1ea622eb639a486db29e9c9ed145476923f4b8e6 @bakura10 bakura10 committed Nov 22, 2012
View
@@ -38,11 +38,11 @@ class Module implements
public function onBootstrap(EventInterface $e)
{
/* @var $app \Zend\Mvc\ApplicationInterface */
- $app = $e->getTarget();
- $events = $app->getEventManager();
+ $app = $e->getTarget();
+ $eventManager = $app->getEventManager();
// Attach to helper set event and load the entity manager helper.
- $events->attach('addPost.post', function(EventInterface $e) {
+ $eventManager->attach('addPost.post', function(EventInterface $e) {
/* @var $threadService \ZfrForum\Service\ThreadService */
$threadService = $e->getTarget();
@@ -99,6 +99,10 @@
* View manager configuration
*/
'view_manager' => array(
+ 'strategies' => array(
+ 'ViewJsonStrategy'
+ ),
+
'template_path_stack' => array(
'ZfrForum' => __DIR__ . '/../view',
),
@@ -12,6 +12,46 @@
),
'may_terminate' => true,
'child_routes' => array(
+ 'categories' => array(
+ 'type' => 'Segment',
+ 'options' => array(
+ 'route' => '/categories[/:id/:slug]',
+ 'constraints' => array(
+ 'id' => '[0-9]+',
+ 'slug' => '[a-zA-Z][a-zA-Z0-9_-]*'
+ ),
+ 'defaults' => array(
+ 'controller' => 'ZfrForum\Controller\Category'
+ )
+ )
+ ),
+
+ 'threads' => array(
+ 'type' => 'Segment',
+ 'options' => array(
+ 'route' => '/threads[/:id/:slug]',
+ 'constraints' => array(
+ 'id' => '[0-9]+',
+ 'slug' => '[a-zA-Z][a-zA-Z0-9_-]*'
+ ),
+ 'defaults' => array(
+ 'controller' => 'ZfrForum\Controller\Thread'
+ )
+ )
+ ),
+
+ 'messages' => array(
+ 'type' => 'Segment',
+ 'options' => array(
+ 'route' => '/messages[/:id]',
+ 'constraints' => array(
+ 'id' => '[0-9]+'
+ ),
+ 'defaults' => array(
+ 'controller' => 'ZfrForum\Controller\Message'
+ )
+ )
+ )
)
)
)
@@ -60,6 +60,13 @@ class Category
*/
protected $description = '';
+ /**
+ * @var int
+ *
+ * @ORM\Column(type="integer")
+ */
+ protected $depth = 1;
+
/**
* Get the identifier of the category
@@ -80,6 +87,8 @@ public function getId()
public function setParent(Category $parent)
{
$this->parent = $parent;
+ $this->depth = $parent->getDepth() + 1;
+
return $this;
}
@@ -146,4 +155,14 @@ public function getDescription()
{
return $this->description;
}
+
+ /**
+ * Get the depth of the category (it begins by 1)
+ *
+ * @return int
+ */
+ public function getDepth()
+ {
+ return $this->depth;
+ }
}
@@ -0,0 +1 @@
+<h1>Show all the categories for the forum</h1>
@@ -0,0 +1 @@
+<p>Display a single message !</p>

0 comments on commit 1ea622e

Please sign in to comment.