partkeepr

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

commit 8535fe3332663ce370cc069aff752298615a19a0
parent 94abaca063a1b8220752568db866e1ee27f12009
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed, 27 May 2015 21:57:23 +0200

Moved Unit to it's own bundle

Diffstat:
Mapp/AppKernel.php | 3++-
Mapp/config/routing.yml | 5+++++
Msrc/PartKeepr/DoctrineReflectionBundle/Controller/DoctrineRESTQueryController.php | 2+-
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/EditorGrid.js | 11++++++-----
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Unit/UnitEditorComponent.js | 3+--
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Ext.ux/SearchField.js | 23+++++++++++++++++------
Msrc/PartKeepr/FrontendBundle/Resources/views/index.html.twig | 10----------
Msrc/PartKeepr/SiPrefixBundle/Controller/DefaultController.php | 3---
Asrc/PartKeepr/UnitBundle/Controller/DefaultController.php | 32++++++++++++++++++++++++++++++++
Asrc/PartKeepr/UnitBundle/DependencyInjection/Configuration.php | 29+++++++++++++++++++++++++++++
Asrc/PartKeepr/UnitBundle/DependencyInjection/PartKeeprUnitExtension.php | 28++++++++++++++++++++++++++++
Asrc/PartKeepr/UnitBundle/Entity/Unit.php | 135+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/PartKeepr/UnitBundle/PartKeeprUnitBundle.php | 9+++++++++
Asrc/PartKeepr/UnitBundle/Resources/config/services.xml | 16++++++++++++++++
Asrc/PartKeepr/UnitBundle/Resources/views/Default/index.html.twig | 1+
Asrc/PartKeepr/UnitBundle/Tests/Controller/DefaultControllerTest.php | 17+++++++++++++++++
Msrc/backend/PartKeepr/Part/PartManager.php | 2+-
Msrc/backend/PartKeepr/PartParameter/PartParameter.php | 12+++++++-----
Msrc/backend/PartKeepr/Setup/UnitSetup.php | 2+-
Dsrc/backend/PartKeepr/Unit/Unit.php | 132-------------------------------------------------------------------------------
Msrc/backend/PartKeepr/Unit/UnitService.php | 1+
21 files changed, 309 insertions(+), 167 deletions(-)

diff --git a/app/AppKernel.php b/app/AppKernel.php @@ -59,7 +59,8 @@ class AppKernel extends Kernel new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new PartKeepr\DoctrineReflectionBundle\PartKeeprDoctrineReflectionBundle(), new PartKeepr\RESTBundle\PartKeeprRESTBundle(), - new PartKeepr\ApiDocBundle\PartKeeprApiDocBundle() + new PartKeepr\ApiDocBundle\PartKeeprApiDocBundle(), + new PartKeepr\UnitBundle\PartKeeprUnitBundle(), ); // Developer bundles diff --git a/app/config/routing.yml b/app/config/routing.yml @@ -1,3 +1,8 @@ +part_keepr_unit: + resource: "@PartKeeprUnitBundle/Controller/" + type: annotation + prefix: / + part_keepr_auth: resource: "@PartKeeprAuthBundle/Controller/" type: annotation diff --git a/src/PartKeepr/DoctrineReflectionBundle/Controller/DoctrineRESTQueryController.php b/src/PartKeepr/DoctrineReflectionBundle/Controller/DoctrineRESTQueryController.php @@ -209,7 +209,7 @@ class DoctrineRESTQueryController extends FOSRestController } if (!array_key_exists("operator", $filter)) { - throw new \Exception("operator parameter has an invalid format"); + $filter["operator"] = "like"; } $filters[] = new Filter($this->getTargetEntity(), $filter["property"], $filter["value"], $filter["operator"]); diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/EditorGrid.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/EditorGrid.js @@ -86,9 +86,6 @@ Ext.define('PartKeepr.EditorGrid', { */ - this.getSelectionModel().on("select", this._onItemSelect, this); - this.getSelectionModel().on("deselect", this._onItemDeselect, this); - this.on("itemclick", this._onItemEdit, this); this.deleteButton = Ext.create("Ext.button.Button", { @@ -111,7 +108,8 @@ Ext.define('PartKeepr.EditorGrid', { }); this.searchField = Ext.create("Ext.ux.form.SearchField",{ - store: this.store + store: this.store, + targetField: 'name' }); var topToolbarItems = []; @@ -152,7 +150,10 @@ Ext.define('PartKeepr.EditorGrid', { this.plugins.push('gridmenu'); this.callParent(); - + + this.getSelectionModel().on("select", this._onItemSelect, this); + this.getSelectionModel().on("deselect", this._onItemDeselect, this); + if (this.automaticPageSize) { this.on("resize", this.reassignPageSize, this); } diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Unit/UnitEditorComponent.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Unit/UnitEditorComponent.js @@ -6,11 +6,10 @@ Ext.define('PartKeepr.UnitEditorComponent', { newItemText: i18n("New Unit"), deleteMessage: i18n("Do you really wish to delete the unit'%s'?"), deleteTitle: i18n("Delete Unit"), - model: 'PartKeepr.Unit', + model: 'PartKeepr.UnitBundle.Entity.Unit', initComponent: function () { this.createStore({ sorters: [{ - proxy: PartKeepr.getRESTProxy("Unit"), property: 'name', direction:'ASC' }] diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Ext.ux/SearchField.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Ext.ux/SearchField.js @@ -22,7 +22,9 @@ Ext.define('Ext.ux.form.SearchField', { /** * Defines the parameter name which is being passed to the store's proxy. */ - paramName : 'query', + targetField : 'query', + + filter: null, /** * Initializes the component. Binds the enter key to startSearch. @@ -34,6 +36,12 @@ Ext.define('Ext.ux.form.SearchField', { this.startSearch(); } }, this); + + this.filter = Ext.create("Ext.util.Filter", { + property: this.targetField, + value: '', + operator: 'like' + }); }, /** * Hides the "clear" trigger as soon as the component is rendered. @@ -41,7 +49,7 @@ Ext.define('Ext.ux.form.SearchField', { afterRender: function(){ this.callParent(); this.triggerCell.item(0).setDisplayed('none'); - this.doComponentLayout(); + //this.doLayout(); }, /** * Handler for the "reset search" trigger @@ -67,13 +75,14 @@ Ext.define('Ext.ux.form.SearchField', { if (me.hasSearch) { me.setValue(''); - proxy.extraParams[me.paramName] = ''; + store.removeFilter(this.filter); + store.currentPage = 1; store.load({ start: 0 }); me.hasSearch = false; me.triggerCell.item(0).setDisplayed('none'); - me.doComponentLayout(); + //me.doComponentLayout(); } }, /** @@ -89,12 +98,14 @@ Ext.define('Ext.ux.form.SearchField', { me.resetSearch(); return; } - proxy.extraParams[me.paramName] = value; + + this.filter.setValue("%"+value+"%"); + store.addFilter(this.filter); store.currentPage = 1; store.load({ start: 0 }); me.hasSearch = true; me.triggerCell.item(0).setDisplayed('block'); - me.doComponentLayout(); + //me.doComponentLayout(); } }); \ No newline at end of file diff --git a/src/PartKeepr/FrontendBundle/Resources/views/index.html.twig b/src/PartKeepr/FrontendBundle/Resources/views/index.html.twig @@ -54,16 +54,6 @@ '@PartKeeprFrontendBundle/Resources/public/js/Dialogs/RememberChoiceMessageBox.js' '@PartKeeprFrontendBundle/Resources/public/js/Data/RestProxy.js' '@PartKeeprFrontendBundle/Resources/public/js/Components/Statusbar.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.input.CharContextMenu.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.data.Connection-sessionInjection.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.tree.View-missingMethods.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.data.Model-setDataWithAssociations.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.grid.Column-injectDefaultRenderer.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.form.field.Trigger-themeAdjustment.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.grid.feature.Grouping.expandCollapseAll.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Enhancements/Ext.data.reader.Json-exceptionHandling.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Bugfixes/Ext.selection.RowModel-EXTJSIV-4312.js' - '@PartKeeprFrontendBundle/Resources/public/js/ExtJS/Bugfixes/Ext.panel.Table-scrollDelta.js' '@PartKeeprFrontendBundle/Resources/public/js/Components/Auth/LoginDialog.js' '@PartKeeprFrontendBundle/Resources/public/js/Components/Printing/PrintingExecutor.js' '@PartKeeprFrontendBundle/Resources/public/js/Components/Printing/PrintingWindow.js' diff --git a/src/PartKeepr/SiPrefixBundle/Controller/DefaultController.php b/src/PartKeepr/SiPrefixBundle/Controller/DefaultController.php @@ -28,7 +28,4 @@ class DefaultController extends DoctrineRESTQueryController return parent::getQueryResponseAction($paramFetcher); } - - - } \ No newline at end of file diff --git a/src/PartKeepr/UnitBundle/Controller/DefaultController.php b/src/PartKeepr/UnitBundle/Controller/DefaultController.php @@ -0,0 +1,31 @@ +<?php + +namespace PartKeepr\UnitBundle\Controller; + +use FOS\RestBundle\Request\ParamFetcher; +use PartKeepr\DoctrineReflectionBundle\Controller\DoctrineRESTQueryController; +use Sensio\Bundle\FrameworkExtraBundle\Configuration as Routing; +use JMS\Serializer\Annotation as JMS; +use Nelmio\ApiDocBundle\Annotation\ApiDoc; +use FOS\RestBundle\Controller\Annotations\View; + +class DefaultController extends DoctrineRESTQueryController +{ + /** + * Retrieves SI Prefixes in the database + * + * @Routing\Route("/unit", defaults={"method" = "get","_format" = "json"}) + * @Routing\Method({"GET"}) + * @ApiDoc(output="array<PartKeepr\UnitBundle\Entity\Unit>") + * + * @View() + * + * {@inheritdoc} + */ + public function getQueryResponseAction(ParamFetcher $paramFetcher) + { + $this->setTargetEntity("PartKeepr\\UnitBundle\\Entity\\Unit"); + + return parent::getQueryResponseAction($paramFetcher); + } +}+ \ No newline at end of file diff --git a/src/PartKeepr/UnitBundle/DependencyInjection/Configuration.php b/src/PartKeepr/UnitBundle/DependencyInjection/Configuration.php @@ -0,0 +1,29 @@ +<?php + +namespace PartKeepr\UnitBundle\DependencyInjection; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +/** + * This is the class that validates and merges configuration from your app/config files + * + * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} + */ +class Configuration implements ConfigurationInterface +{ + /** + * {@inheritdoc} + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('part_keepr_unit'); + + // Here you should define the parameters that are allowed to + // configure your bundle. See the documentation linked above for + // more information on that topic. + + return $treeBuilder; + } +} diff --git a/src/PartKeepr/UnitBundle/DependencyInjection/PartKeeprUnitExtension.php b/src/PartKeepr/UnitBundle/DependencyInjection/PartKeeprUnitExtension.php @@ -0,0 +1,28 @@ +<?php + +namespace PartKeepr\UnitBundle\DependencyInjection; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Loader; + +/** + * This is the class that loads and manages your bundle configuration + * + * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} + */ +class PartKeeprUnitExtension extends Extension +{ + /** + * {@inheritdoc} + */ + public function load(array $configs, ContainerBuilder $container) + { + $configuration = new Configuration(); + $config = $this->processConfiguration($configuration, $configs); + + $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.xml'); + } +} diff --git a/src/PartKeepr/UnitBundle/Entity/Unit.php b/src/PartKeepr/UnitBundle/Entity/Unit.php @@ -0,0 +1,134 @@ +<?php +namespace PartKeepr\UnitBundle\Entity; + +use PartKeepr\Unit\ArrayCollection; +use PartKeepr\Util\Deserializable, + PartKeepr\Util\Serializable, + PartKeepr\Util\BaseEntity, + PartKeepr\PartKeepr, + PartKeepr\Util\Exceptions\OutOfRangeException, + PartKeepr\SiPrefixBundle\Entity\SiPrefix, + Doctrine\ORM\Mapping as ORM, + PartKeepr\DoctrineReflectionBundle\Annotation\TargetService; + + +/** + * This object represents an unit. Units can be: Volt, Hertz etc. + * + * @ORM\Entity + * @TargetService(uri="/unit") + **/ +class Unit extends BaseEntity implements Serializable, Deserializable { + /** + * The name of the unit (e.g. Volts, Ampere, Farad, Metres) + * @ORM\Column(type="string") + * @var string + */ + private $name; + + /** + * The symbol of the unit (e.g. V, A, F, m) + * @ORM\Column(type="string") + * @var string + */ + private $symbol; + + /** + * Defines the allowed SiPrefixes for this parameter unit + * @ORM\ManyToMany(targetEntity="PartKeepr\SiPrefixBundle\Entity\SiPrefix") + * @ORM\JoinTable(name="UnitSiPrefixes", + * joinColumns={@ORM\JoinColumn(name="unit_id", referencedColumnName="id")}, + * inverseJoinColumns={@ORM\JoinColumn(name="siprefix_id", referencedColumnName="id")} + * ) + * @var ArrayCollection + */ + private $prefixes; + + /** + * Creates a new Unit. + */ + public function __construct () { + $this->prefixes = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Sets the name for this unit + * @param string $name the name for this unit + */ + public function setName ($name) { + $this->name = $name; + } + + /** + * Returns the name for this unit + * @return string The unit name + */ + public function getName () { + return $this->name; + } + + /** + * Sets the symbol for this unit + * @param string $symbol The symbol + */ + public function setSymbol ($symbol) { + $this->symbol = $symbol; + } + + /** + * Returns the symbol for this unit + * @return string The symbol + */ + public function getSymbol () { + return $this->symbol; + } + + /** + * Returns the si-prefix list for this unit + * @return array An array of SiPrefix objects + */ + public function getPrefixes () { + return $this->prefixes; + } + + /** + * Serializes the user object and returns it as array, suitable + * to process via json_encode. + * @param none + * @return array An array containing the object information + */ + public function serialize () { + return array( + "id" => $this->getId(), + "name" => $this->getName(), + "symbol" => $this->getSymbol(), + "prefixes" => $this->serializeChildren($this->getPrefixes()) + ); + } + + /** + * Deserializes the unit + * @param array $parameters The array with the parameters to set + */ + public function deserialize (array $parameters) { + foreach ($parameters as $key => $value) { + switch ($key) { + case "name": + $this->setName($value); + break; + case "symbol": + $this->setSymbol($value); + break; + case "prefixes": + $prefixes = $this->getPrefixes(); + $prefixes->clear(); + + foreach ($value as $prefix) { + $prefix = SiPrefix::loadById($prefix["id"]); + $prefixes->add($prefix); + } + break; + } + } + } +}+ \ No newline at end of file diff --git a/src/PartKeepr/UnitBundle/PartKeeprUnitBundle.php b/src/PartKeepr/UnitBundle/PartKeeprUnitBundle.php @@ -0,0 +1,9 @@ +<?php + +namespace PartKeepr\UnitBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +class PartKeeprUnitBundle extends Bundle +{ +} diff --git a/src/PartKeepr/UnitBundle/Resources/config/services.xml b/src/PartKeepr/UnitBundle/Resources/config/services.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" ?> + +<container xmlns="http://symfony.com/schema/dic/services" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + <!-- + <services> + <service id="part_keepr_unit.example" class="PartKeepr\UnitBundle\Example"> + <argument type="service" id="service_id" /> + <argument>plain_value</argument> + <argument>%parameter_name%</argument> + </service> + </services> + --> +</container> diff --git a/src/PartKeepr/UnitBundle/Resources/views/Default/index.html.twig b/src/PartKeepr/UnitBundle/Resources/views/Default/index.html.twig @@ -0,0 +1 @@ +Hello {{ name }}! diff --git a/src/PartKeepr/UnitBundle/Tests/Controller/DefaultControllerTest.php b/src/PartKeepr/UnitBundle/Tests/Controller/DefaultControllerTest.php @@ -0,0 +1,17 @@ +<?php + +namespace PartKeepr\UnitBundle\Tests\Controller; + +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; + +class DefaultControllerTest extends WebTestCase +{ + public function testIndex() + { + $client = static::createClient(); + + $crawler = $client->request('GET', '/hello/Fabien'); + + $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0); + } +} diff --git a/src/backend/PartKeepr/Part/PartManager.php b/src/backend/PartKeepr/Part/PartManager.php @@ -8,7 +8,7 @@ use PartKeepr\UploadedFile\TempUploadedFile, Doctrine\ORM\QueryBuilder, PartKeepr\PartParameter\PartParameter, PartKeepr\Manager\AbstractManager, - PartKeepr\Unit\Unit, + PartKeepr\UnitBundle\Entity\Unit, PartKeepr\SiPrefixBundle\Entity\SiPrefix, PartKeepr\Part\PartDistributor, PartKeepr\Part\PartManufacturer, diff --git a/src/backend/PartKeepr/PartParameter/PartParameter.php b/src/backend/PartKeepr/PartParameter/PartParameter.php @@ -3,7 +3,7 @@ namespace PartKeepr\PartParameter; use PartKeepr\PartKeepr, PartKeepr\Util\Exceptions\OutOfRangeException, -PartKeepr\Unit\Unit, +PartKeepr\UnitBundle\Entity\Unit, PartKeepr\Part\Part, PartKeepr\SiPrefixBundle\Entity\SiPrefix, Doctrine\ORM\Mapping as ORM; @@ -47,8 +47,8 @@ class PartParameter { /** * The unit for this type. May be null. * - * @ORM\ManyToOne(targetEntity="PartKeepr\Unit\Unit") - * @var Unit + * @ORM\ManyToOne(targetEntity="PartKeepr\UnitBundle\Entity\Unit") + * @var \PartKeepr\UnitBundle\Entity\Unit */ private $unit; @@ -110,7 +110,8 @@ class PartParameter { /** * Sets the unit - * @param Unit $unit The unit to set + * +*@param \PartKeepr\UnitBundle\Entity\Unit $unit The unit to set */ public function setUnit (Unit $unit = null) { $this->unit = $unit; @@ -118,7 +119,8 @@ class PartParameter { /** * Returns the unit - * @return Unit the unit + * +*@return \PartKeepr\UnitBundle\Entity\Unit the unit */ public function getUnit () { return $this->unit; diff --git a/src/backend/PartKeepr/Setup/UnitSetup.php b/src/backend/PartKeepr/Setup/UnitSetup.php @@ -2,7 +2,7 @@ namespace PartKeepr\Setup; use PartKeepr\PartKeepr, - PartKeepr\Unit\Unit, + PartKeepr\UnitBundle\Entity\Unit, PartKeepr\SiPrefixBundle\Model\SiPrefixManager, PartKeepr\Unit\UnitManager, PartKeepr\Setup\SiPrefixSetup; diff --git a/src/backend/PartKeepr/Unit/Unit.php b/src/backend/PartKeepr/Unit/Unit.php @@ -1,131 +0,0 @@ -<?php -namespace PartKeepr\Unit; - -use PartKeepr\Util\Deserializable, - PartKeepr\Util\Serializable, - PartKeepr\Util\BaseEntity, - PartKeepr\PartKeepr, - PartKeepr\Util\Exceptions\OutOfRangeException, - PartKeepr\SiPrefixBundle\Entity\SiPrefix, - Doctrine\ORM\Mapping as ORM; - - -/** - * This object represents an unit. Units can be: Volt, Hertz etc. - * - * @ORM\Entity - **/ -class Unit extends BaseEntity implements Serializable, Deserializable { - /** - * The name of the unit (e.g. Volts, Ampere, Farad, Metres) - * @ORM\Column(type="string") - * @var string - */ - private $name; - - /** - * The symbol of the unit (e.g. V, A, F, m) - * @ORM\Column(type="string") - * @var string - */ - private $symbol; - - /** - * Defines the allowed SiPrefixes for this parameter unit - * @ORM\ManyToMany(targetEntity="PartKeepr\SiPrefixBundle\Entity\SiPrefix") - * @ORM\JoinTable(name="UnitSiPrefixes", - * joinColumns={@ORM\JoinColumn(name="unit_id", referencedColumnName="id")}, - * inverseJoinColumns={@ORM\JoinColumn(name="siprefix_id", referencedColumnName="id")} - * ) - * @var ArrayCollection - */ - private $prefixes; - - /** - * Creates a new Unit. - */ - public function __construct () { - $this->prefixes = new \Doctrine\Common\Collections\ArrayCollection(); - } - - /** - * Sets the name for this unit - * @param string $name the name for this unit - */ - public function setName ($name) { - $this->name = $name; - } - - /** - * Returns the name for this unit - * @return string The unit name - */ - public function getName () { - return $this->name; - } - - /** - * Sets the symbol for this unit - * @param string $symbol The symbol - */ - public function setSymbol ($symbol) { - $this->symbol = $symbol; - } - - /** - * Returns the symbol for this unit - * @return string The symbol - */ - public function getSymbol () { - return $this->symbol; - } - - /** - * Returns the si-prefix list for this unit - * @return array An array of SiPrefix objects - */ - public function getPrefixes () { - return $this->prefixes; - } - - /** - * Serializes the user object and returns it as array, suitable - * to process via json_encode. - * @param none - * @return array An array containing the object information - */ - public function serialize () { - return array( - "id" => $this->getId(), - "name" => $this->getName(), - "symbol" => $this->getSymbol(), - "prefixes" => $this->serializeChildren($this->getPrefixes()) - ); - } - - /** - * Deserializes the unit - * @param array $parameters The array with the parameters to set - */ - public function deserialize (array $parameters) { - foreach ($parameters as $key => $value) { - switch ($key) { - case "name": - $this->setName($value); - break; - case "symbol": - $this->setSymbol($value); - break; - case "prefixes": - $prefixes = $this->getPrefixes(); - $prefixes->clear(); - - foreach ($value as $prefix) { - $prefix = SiPrefix::loadById($prefix["id"]); - $prefixes->add($prefix); - } - break; - } - } - } -}- \ No newline at end of file diff --git a/src/backend/PartKeepr/Unit/UnitService.php b/src/backend/PartKeepr/Unit/UnitService.php @@ -7,6 +7,7 @@ use PartKeepr\Service\RestfulService, PartKeepr\Part\PartUnit, PartKeepr\SiPrefixBundle\Entity\SiPrefix, PartKeepr\Session\SessionManager; +use PartKeepr\UnitBundle\Entity\Unit; class UnitService extends Service implements RestfulService { public function get () {