partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit b39ebc3eddf30662e946e20e236025a296153117
parent bbf42883b6656e42f2500fb9727079af3feb0d2b
Author: Felicitus <felicitus@felicitus.org>
Date:   Tue, 17 Dec 2013 21:51:26 +0100

Refactored namespace from "model" to "entity", added initial service controller implementation

Diffstat:
Asrc/PartKeepr/SiPrefixBundle/Controller/DefaultController.php | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/PartKeepr/SiPrefixBundle/Controller/DefaultController.php b/src/PartKeepr/SiPrefixBundle/Controller/DefaultController.php @@ -0,0 +1,29 @@ +<?php + +namespace PartKeepr\SiPrefixBundle\Controller; + +use FOS\RestBundle\Controller\FOSRestController; +use PartKeepr\Manager\ManagerFilter; +use PartKeepr\SiPrefix\SiPrefixManager; +use Symfony\Component\Routing\Annotation\Route; +use Nelmio\ApiDocBundle\Annotation\ApiDoc; +use FOS\RestBundle\Controller\Annotations\View; + +class DefaultController extends FOSRestController { + /** + * @Route("/siprefix/get/", defaults={"method" = "get"}) + * @ApiDoc(description="Retrieves all SI Prefixes in the database") + * @View() + */ + public function getSiPrefixesAction () { + $siPrefixes = SiPrefixManager::getInstance()->getList(new ManagerFilter()); + + $data = array(); + + foreach ($siPrefixes["data"] as $siPrefix) { + $data[] = SiPrefixManager::getInstance()->getEntity($siPrefix["id"]); + } + return $data; + } + +}+ \ No newline at end of file