partkeepr

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

commit 7808efee98fb0bffd72522eab55fb92c97cecad9
parent f7fbe72e1058fd2d32696d15ed121fa19960263a
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed, 22 Jul 2015 00:00:29 +0200

Added one to one relationships

Diffstat:
Msrc/PartKeepr/DoctrineReflectionBundle/Resources/views/model.js.twig | 13+++++++++++++
Msrc/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php | 4++++
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/PartKeepr/DoctrineReflectionBundle/Resources/views/model.js.twig b/src/PartKeepr/DoctrineReflectionBundle/Resources/views/model.js.twig @@ -33,6 +33,19 @@ Ext.define('{{ className }}', { ], {% endif %} + {% if associations.ONE_TO_ONE|length > 0 %} + hasOne: [ + {% for association in associations.ONE_TO_ONE %} + { + name: '{{ association.name }}', + associationKey: '{{ association.name }}', + model: '{{ association.target }}' + }{% if not loop.last %},{% endif %} + + {% endfor %} + ], + {% endif %} + {% if associations.MANY_TO_MANY|length > 0 %} manyToMany: { diff --git a/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php b/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php @@ -100,6 +100,10 @@ class ReflectionService $associationType = "ONE_TO_MANY"; $getterPlural = true; break; + case ClassMetadataInfo::ONE_TO_ONE: + $associationType = "ONE_TO_ONE"; + $getterPlural = false; + break; } $getter = "get".ucfirst($association["fieldName"]);