From 38f9d9069baab2026fac83912a68fc7d556773a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr>
Date: Mon, 20 Aug 2018 11:04:24 +0200
Subject: [PATCH] =?UTF-8?q?R=C3=A9organisation=20des=20sources.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/{ => Models}/AnonymousObject.php |  2 +-
 src/{ => Models}/BuiltinType.php     |  2 +-
 src/{ => Models}/Collection.php      |  2 +-
 src/{ => Models}/Context.php         |  2 +-
 src/{ => Models}/Declarable.php      |  2 +-
 src/{ => Models}/NamedTrait.php      |  2 +-
 src/{ => Models}/NamedType.php       |  2 +-
 src/{ => Models}/NonResource.php     |  2 +-
 src/{ => Models}/Operation.php       |  2 +-
 src/{ => Models}/Parameter.php       |  2 +-
 src/{ => Models}/Property.php        |  2 +-
 src/{ => Models}/Referencable.php    |  2 +-
 src/{ => Models}/Reference.php       |  2 +-
 src/{ => Models}/Repository.php      |  2 +-
 src/{ => Models}/Representation.php  |  2 +-
 src/{ => Models}/Type.php            |  2 +-
 src/{ => Models}/Union.php           |  2 +-
 src/Serializer.php                   | 14 +++++++++++++-
 18 files changed, 30 insertions(+), 18 deletions(-)
 rename src/{ => Models}/AnonymousObject.php (98%)
 rename src/{ => Models}/BuiltinType.php (95%)
 rename src/{ => Models}/Collection.php (97%)
 rename src/{ => Models}/Context.php (99%)
 rename src/{ => Models}/Declarable.php (95%)
 rename src/{ => Models}/NamedTrait.php (97%)
 rename src/{ => Models}/NamedType.php (95%)
 rename src/{ => Models}/NonResource.php (96%)
 rename src/{ => Models}/Operation.php (99%)
 rename src/{ => Models}/Parameter.php (97%)
 rename src/{ => Models}/Property.php (98%)
 rename src/{ => Models}/Referencable.php (95%)
 rename src/{ => Models}/Reference.php (97%)
 rename src/{ => Models}/Repository.php (97%)
 rename src/{ => Models}/Representation.php (98%)
 rename src/{ => Models}/Type.php (97%)
 rename src/{ => Models}/Union.php (97%)

diff --git a/src/AnonymousObject.php b/src/Models/AnonymousObject.php
similarity index 98%
rename from src/AnonymousObject.php
rename to src/Models/AnonymousObject.php
index 81e6732..14a9f69 100644
--- a/src/AnonymousObject.php
+++ b/src/Models/AnonymousObject.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class AnonymousObject.
diff --git a/src/BuiltinType.php b/src/Models/BuiltinType.php
similarity index 95%
rename from src/BuiltinType.php
rename to src/Models/BuiltinType.php
index 59db626..a05b5f9 100644
--- a/src/BuiltinType.php
+++ b/src/Models/BuiltinType.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class BuiltinType.
diff --git a/src/Collection.php b/src/Models/Collection.php
similarity index 97%
rename from src/Collection.php
rename to src/Models/Collection.php
index 715d569..d5a202b 100644
--- a/src/Collection.php
+++ b/src/Models/Collection.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Collection.
diff --git a/src/Context.php b/src/Models/Context.php
similarity index 99%
rename from src/Context.php
rename to src/Models/Context.php
index f309884..4351a35 100644
--- a/src/Context.php
+++ b/src/Models/Context.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 use ApiPlatform\Core\Api\OperationType;
 use ApiPlatform\Core\Metadata\Resource\ResourceMetadata;
diff --git a/src/Declarable.php b/src/Models/Declarable.php
similarity index 95%
rename from src/Declarable.php
rename to src/Models/Declarable.php
index e175fed..af95b32 100644
--- a/src/Declarable.php
+++ b/src/Models/Declarable.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Interface Declarable.
diff --git a/src/NamedTrait.php b/src/Models/NamedTrait.php
similarity index 97%
rename from src/NamedTrait.php
rename to src/Models/NamedTrait.php
index fbcba3e..aa843cc 100644
--- a/src/NamedTrait.php
+++ b/src/Models/NamedTrait.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class NamedTrait.
diff --git a/src/NamedType.php b/src/Models/NamedType.php
similarity index 95%
rename from src/NamedType.php
rename to src/Models/NamedType.php
index dc3eeaa..c161b57 100644
--- a/src/NamedType.php
+++ b/src/Models/NamedType.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class NamedType.
diff --git a/src/NonResource.php b/src/Models/NonResource.php
similarity index 96%
rename from src/NonResource.php
rename to src/Models/NonResource.php
index 648e44c..5a4eb5b 100644
--- a/src/NonResource.php
+++ b/src/Models/NonResource.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class NonResource.
diff --git a/src/Operation.php b/src/Models/Operation.php
similarity index 99%
rename from src/Operation.php
rename to src/Models/Operation.php
index 62243da..952a151 100644
--- a/src/Operation.php
+++ b/src/Models/Operation.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 use ApiPlatform\Core\Api\OperationType;
 use Doctrine\Common\Inflector\Inflector;
diff --git a/src/Parameter.php b/src/Models/Parameter.php
similarity index 97%
rename from src/Parameter.php
rename to src/Models/Parameter.php
index 91ec702..93f18de 100644
--- a/src/Parameter.php
+++ b/src/Models/Parameter.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Parameter.
diff --git a/src/Property.php b/src/Models/Property.php
similarity index 98%
rename from src/Property.php
rename to src/Models/Property.php
index 62f1bdf..baceba0 100644
--- a/src/Property.php
+++ b/src/Models/Property.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Property.
diff --git a/src/Referencable.php b/src/Models/Referencable.php
similarity index 95%
rename from src/Referencable.php
rename to src/Models/Referencable.php
index 3d4ec15..1306957 100644
--- a/src/Referencable.php
+++ b/src/Models/Referencable.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Interface Referencable.
diff --git a/src/Reference.php b/src/Models/Reference.php
similarity index 97%
rename from src/Reference.php
rename to src/Models/Reference.php
index 0026c8c..fb6856a 100644
--- a/src/Reference.php
+++ b/src/Models/Reference.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Ref.
diff --git a/src/Repository.php b/src/Models/Repository.php
similarity index 97%
rename from src/Repository.php
rename to src/Models/Repository.php
index 887166a..62bf31a 100644
--- a/src/Repository.php
+++ b/src/Models/Repository.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Repository.
diff --git a/src/Representation.php b/src/Models/Representation.php
similarity index 98%
rename from src/Representation.php
rename to src/Models/Representation.php
index 1e89749..18c5497 100644
--- a/src/Representation.php
+++ b/src/Models/Representation.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Representation.
diff --git a/src/Type.php b/src/Models/Type.php
similarity index 97%
rename from src/Type.php
rename to src/Models/Type.php
index aa24df0..25fa6f2 100644
--- a/src/Type.php
+++ b/src/Models/Type.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Type.
diff --git a/src/Union.php b/src/Models/Union.php
similarity index 97%
rename from src/Union.php
rename to src/Models/Union.php
index 52854c8..3cf1c79 100644
--- a/src/Union.php
+++ b/src/Models/Union.php
@@ -17,7 +17,7 @@
  * <https://www.gnu.org/licenses/>.
  */
 
-namespace Irstea\NgModelGeneratorBundle;
+namespace Irstea\NgModelGeneratorBundle\Models;
 
 /**
  * Class Union.
diff --git a/src/Serializer.php b/src/Serializer.php
index a7958d1..e0abc29 100644
--- a/src/Serializer.php
+++ b/src/Serializer.php
@@ -29,6 +29,18 @@ use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInte
 use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
 use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
 use ApiPlatform\Core\PathResolver\OperationPathResolverInterface;
+use Irstea\NgModelGeneratorBundle\Models\AnonymousObject;
+use Irstea\NgModelGeneratorBundle\Models\BuiltinType;
+use Irstea\NgModelGeneratorBundle\Models\Collection;
+use Irstea\NgModelGeneratorBundle\Models\Context;
+use Irstea\NgModelGeneratorBundle\Models\NonResource;
+use Irstea\NgModelGeneratorBundle\Models\Operation;
+use Irstea\NgModelGeneratorBundle\Models\Parameter;
+use Irstea\NgModelGeneratorBundle\Models\Property;
+use Irstea\NgModelGeneratorBundle\Models\Reference;
+use Irstea\NgModelGeneratorBundle\Models\Repository;
+use Irstea\NgModelGeneratorBundle\Models\Representation;
+use Irstea\NgModelGeneratorBundle\Models\Type;
 use Psr\Container\ContainerInterface;
 use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
 use Symfony\Component\PropertyInfo\Type as APIType;
@@ -592,6 +604,6 @@ class Serializer implements NormalizerInterface, EncoderInterface
      */
     public function encode($data, $format, array $context = [])
     {
-        return $this->twigEnv->render('typescript_models.ts.twig', $data);
+        return $this->twigEnv->render(__DIR__ . '/Resources/views/typescript_models.ts.twig', $data);
     }
 }
-- 
GitLab