partkeepr

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

commit 7e1e7926fd186f4574b6af75b0462c8e023f6b3b
parent 80dea2c0da205e8ee7fecf94cf83fbb25305f461
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed, 23 Sep 2015 18:24:59 +0200

Added support to set IgnoreIds on a per-entity level

Diffstat:
Asrc/PartKeepr/DoctrineReflectionBundle/Annotation/IgnoreIds.php | 12++++++++++++
Msrc/PartKeepr/DoctrineReflectionBundle/Resources/views/model.js.twig | 6++++--
Msrc/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php | 11+++++++++++
Msrc/PartKeepr/FrontendBundle/Resources/public/js/PartKeepr.js | 3+--
4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/src/PartKeepr/DoctrineReflectionBundle/Annotation/IgnoreIds.php b/src/PartKeepr/DoctrineReflectionBundle/Annotation/IgnoreIds.php @@ -0,0 +1,12 @@ +<?php +namespace PartKeepr\DoctrineReflectionBundle\Annotation; + +use Doctrine\ORM\Mapping\Annotation; + +/** + * @Annotation + * @Target("CLASS") + */ +final class IgnoreIds implements Annotation +{ +} diff --git a/src/PartKeepr/DoctrineReflectionBundle/Resources/views/model.js.twig b/src/PartKeepr/DoctrineReflectionBundle/Resources/views/model.js.twig @@ -58,5 +58,8 @@ Ext.define('{{ className }}', { proxy: { type: "Hydra", url: '{% if uri == "" %}undefined:{{ className }}{% else %}{{ uri|raw }}{% endif %}' + {% if ignoreIds == true %} + , ignoreIds: true + {% endif %} } -});- \ No newline at end of file +}); diff --git a/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php b/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php @@ -146,6 +146,17 @@ class ReflectionService $renderParams["uri"] = $targetService->uri; } + $ignoreIds = $this->reader->getClassAnnotation( + $cm->getReflectionClass(), + "PartKeepr\DoctrineReflectionBundle\Annotation\IgnoreIds" + ); + + if ($ignoreIds !== null) { + $renderParams["ignoreIds"] = true; + } else { + $renderParams["ignoreIds"] = false; + } + return $this->templateEngine->render('PartKeeprDoctrineReflectionBundle::model.js.twig', $renderParams); } diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/PartKeepr.js b/src/PartKeepr/FrontendBundle/Resources/public/js/PartKeepr.js @@ -337,6 +337,7 @@ Ext.application({ if (record) { record.set("preferenceValue", value); + record.save(); } else { var j = new PartKeepr.AuthBundle.Entity.UserPreference(); j.set("preferenceKey", key); @@ -344,8 +345,6 @@ Ext.application({ this.userPreferenceStore.add(j); } - - this.userPreferenceStore.sync(); }, getUserPreferenceStore: function () {