Permalink
Browse files

Merge pull request #39 from bakura10/categories

Ajout des controllers et refactoring des categories
  • Loading branch information...
2 parents fdf1a2d + 6d688b1 commit c9a0ceaaf1db54b9939c88762b9de1efc4698da1 @bakura10 bakura10 committed Nov 22, 2012
@@ -88,7 +88,11 @@
* Controllers
*/
'controllers' => array(
- 'invokables' => array()
+ 'invokables' => array(
+ 'ZfrForum\Controller\Category' => 'ZfrForum\Controller\CategoryController',
+ 'ZfrForum\Controller\Message' => 'ZfrForum\Controller\MessageController',
+ 'ZfrForum\Controller\Thread' => 'ZfrForum\Controller\ThreadController'
+ )
),
/**
@@ -1,5 +1,18 @@
<?php
return array(
- 'routes' => array()
+ 'routes' => array(
+ 'zfrforum' => array(
+ 'type' => 'Literal',
+ 'options' => array(
+ 'route' => '/forum/',
+ 'defaults' => array(
+ 'controller' => 'ZfrForum\Controller\Category'
+ )
+ ),
+ 'may_terminate' => true,
+ 'child_routes' => array(
+ )
+ )
+ )
);
@@ -0,0 +1,98 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the MIT license.
+ */
+
+namespace ZfrForum\Controller;
+
+use Zend\Mvc\Controller\AbstractRestfulController;
+use ZfrForum\Service\CategoryService;
+
+class CategoryController extends AbstractRestfulController
+{
+ /**
+ * @var CategoryService
+ */
+ protected $categoryService;
+
+
+ /**
+ * Return list of resources
+ *
+ * @return mixed
+ */
+ public function getList()
+ {
+ // TODO: Implement getList() method.
+ }
+
+ /**
+ * Return single resource
+ *
+ * @param mixed $id
+ * @return mixed
+ */
+ public function get($id)
+ {
+ // TODO: Implement get() method.
+ }
+
+ /**
+ * Create a new resource
+ *
+ * @param mixed $data
+ * @return mixed
+ */
+ public function create($data)
+ {
+ // TODO: Implement create() method.
+ }
+
+ /**
+ * Update an existing resource
+ *
+ * @param mixed $id
+ * @param mixed $data
+ * @return mixed
+ */
+ public function update($id, $data)
+ {
+ // TODO: Implement update() method.
+ }
+
+ /**
+ * Delete an existing resource
+ *
+ * @param mixed $id
+ * @return mixed
+ */
+ public function delete($id)
+ {
+ // TODO: Implement delete() method.
+ }
+
+ /**
+ * @return CategoryService
+ */
+ public function getCategoryService()
+ {
+ if ($this->categoryService === null) {
+ $this->categoryService = $this->serviceLocator->get('ZfrForum\Service\CategoryService');
+ }
+
+ return $this->categoryService;
+ }
+}
@@ -0,0 +1,79 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the MIT license.
+ */
+
+namespace ZfrForum\Controller;
+
+use Zend\Mvc\Controller\AbstractRestfulController;
+
+class MessageController extends AbstractRestfulController
+{
+ /**
+ * Return list of resources
+ *
+ * @return mixed
+ */
+ public function getList()
+ {
+ // TODO: Implement getList() method.
+ }
+
+ /**
+ * Return single resource
+ *
+ * @param mixed $id
+ * @return mixed
+ */
+ public function get($id)
+ {
+ // TODO: Implement get() method.
+ }
+
+ /**
+ * Create a new resource
+ *
+ * @param mixed $data
+ * @return mixed
+ */
+ public function create($data)
+ {
+ // TODO: Implement create() method.
+ }
+
+ /**
+ * Update an existing resource
+ *
+ * @param mixed $id
+ * @param mixed $data
+ * @return mixed
+ */
+ public function update($id, $data)
+ {
+ // TODO: Implement update() method.
+ }
+
+ /**
+ * Delete an existing resource
+ *
+ * @param mixed $id
+ * @return mixed
+ */
+ public function delete($id)
+ {
+ // TODO: Implement delete() method.
+ }
+}
@@ -0,0 +1,99 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the MIT license.
+ */
+
+namespace ZfrForum\Controller;
+
+use Zend\Mvc\Controller\AbstractRestfulController;
+use ZfrForum\Entity\Thread;
+use ZfrForum\Service\ThreadService;
+
+class ThreadController extends AbstractRestfulController
+{
+ /**
+ * @var ThreadService
+ */
+ protected $threadService;
+
+
+ /**
+ * Return list of resources
+ *
+ * @return mixed
+ */
+ public function getList()
+ {
+ //return $this->threadService
+ }
+
+ /**
+ * Return single resource
+ *
+ * @param mixed $id
+ * @return Thread|null
+ */
+ public function get($id)
+ {
+ return $this->threadService->getById($id);
+ }
+
+ /**
+ * Create a new resource
+ *
+ * @param mixed $data
+ * @return mixed
+ */
+ public function create($data)
+ {
+ // TODO: Implement create() method.
+ }
+
+ /**
+ * Update an existing resource
+ *
+ * @param mixed $id
+ * @param mixed $data
+ * @return mixed
+ */
+ public function update($id, $data)
+ {
+ // TODO: Implement update() method.
+ }
+
+ /**
+ * Delete an existing resource
+ *
+ * @param mixed $id
+ * @return mixed
+ */
+ public function delete($id)
+ {
+ // TODO: Implement delete() method.
+ }
+
+ /**
+ * @return ThreadService
+ */
+ public function getThreadService()
+ {
+ if ($this->threadService === null) {
+ $this->threadService = $this->serviceLocator->get('ZfrForum\Service\ThreadService');
+ }
+
+ return $this->threadService;
+ }
+}
Oops, something went wrong.

0 comments on commit c9a0cea

Please sign in to comment.