]> Raphaël G. Git Repositories - blogbundle/commitdiff
Version 0.0.2 master 0.0.2
authorRaphaël Gertz <git@rapsys.eu>
Thu, 26 Nov 2026 16:02:51 +0000 (17:02 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 26 Nov 2026 16:02:51 +0000 (17:02 +0100)
27 files changed:
Controller/AbstractController.php
Controller/DefaultController.php
Factory/RepositoryFactory.php
RapsysBlogBundle.php
Repository.php [moved from Repository/EntityRepository.php with 92% similarity]
Repository/ArticleRepository.php
Repository/KeywordRepository.php
Repository/UserRepository.php
config/doctrine/Article.orm.xml [new file with mode: 0644]
config/doctrine/Article.orm.yml [deleted file]
config/doctrine/ArticleTranslation.orm.xml [new file with mode: 0644]
config/doctrine/ArticleTranslation.orm.yml [deleted file]
config/doctrine/Civility.orm.xml [new file with mode: 0644]
config/doctrine/Civility.orm.yml [deleted file]
config/doctrine/Group.orm.xml [new file with mode: 0644]
config/doctrine/Group.orm.yml [deleted file]
config/doctrine/Keyword.orm.xml [new file with mode: 0644]
config/doctrine/Keyword.orm.yml [deleted file]
config/doctrine/KeywordTranslation.orm.xml [new file with mode: 0644]
config/doctrine/KeywordTranslation.orm.yml [deleted file]
config/doctrine/User.orm.xml [new file with mode: 0644]
config/doctrine/User.orm.yml [deleted file]
config/doctrine/UserTranslation.orm.xml [new file with mode: 0644]
config/doctrine/UserTranslation.orm.yml [deleted file]
config/packages/rapsysblog.yaml
templates/form/form_div_layout.html.twig
templates/form/register.html.twig

index fca2be926746fc610f97fe6d657fcdd72474f7db..db1384d9647aa7d51aa66b2bf6adeafc05521d60 100644 (file)
@@ -78,7 +78,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
        /**
         * Modified DateTime
         */
-       protected \DateTime $modified;
+       protected \DateTimeImmutable $modified;
 
        /**
         * Page integer
@@ -351,7 +351,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
         *
         * {@inheritdoc}
         */
-       protected function render(string $view, array $parameters = [], Response $response = null): Response {
+       protected function render(string $view, array $parameters = [], ?Response $response = null): Response {
                //Create response when null
                $response ??= new Response();
 
index 962c0b8636c279198844bf2ec6f76440a2a28f22..dde63352357d82620df10e3042cc7832d94c5f1d 100644 (file)
@@ -144,7 +144,7 @@ class DefaultController extends AbstractController {
                                        $this->addFlash('notice', $this->translator->trans('Your message has been sent'));
 
                                        //Redirect on the same route with sent=1 to cleanup form
-                                       return $this->redirectToRoute($request->get('_route'), $request->get('_route_params'));
+                                       return $this->redirectToRoute($request->attributes->get('_route'), $request->attributes->get('_route_params'));
                                //Catch obvious transport exception
                                } catch(TransportExceptionInterface $e) {
                                        //Add error message mail unreachable
@@ -203,7 +203,7 @@ class DefaultController extends AbstractController {
                //Without keywords
                } else {
                        //Set empty modified
-                       $this->modified = new \DateTime('-1 year');
+                       $this->modified = new \DateTimeImmutable('-1 year');
                }
 
                //Create response
@@ -212,7 +212,7 @@ class DefaultController extends AbstractController {
                //With logged user
                if ($this->checker->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
                        //Set last modified
-                       $response->setLastModified(new \DateTime('-1 year'));
+                       $response->setLastModified(new \DateTimeImmutable('-1 year'));
 
                        //Set as private
                        $response->setPrivate();
index 893b03b6f1fe0edc3ba7d5b51a84aa95d24a3ab7..a795410e2779d1860e800f1ed99ccede8c0f7a99 100644 (file)
@@ -13,7 +13,7 @@ namespace Rapsys\BlogBundle\Factory;
 
 use Doctrine\ORM\EntityManagerInterface;
 use Doctrine\ORM\Repository\RepositoryFactory as RepositoryFactoryInterface;
-use Doctrine\Persistence\ObjectRepository;
+use Doctrine\ORM\EntityRepository;
 use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\Routing\RouterInterface;
 use Symfony\Contracts\Translation\TranslatorInterface;
@@ -106,7 +106,7 @@ final class RepositoryFactory implements RepositoryFactoryInterface {
        /**
         * {@inheritdoc}
         */
-       public function getRepository(EntityManagerInterface $entityManager, mixed $entityName): ObjectRepository {
+       public function getRepository(EntityManagerInterface $entityManager, mixed $entityName): EntityRepository {
                //Set repository hash
                $repositoryHash = $entityManager->getClassMetadata($entityName)->getName() . spl_object_hash($entityManager);
 
@@ -126,7 +126,7 @@ final class RepositoryFactory implements RepositoryFactoryInterface {
         * @param EntityManagerInterface $entityManager The EntityManager instance.
         * @param string $entityName The name of the entity.
         */
-       private function createRepository(EntityManagerInterface $entityManager, string $entityName): ObjectRepository {
+       private function createRepository(EntityManagerInterface $entityManager, string $entityName): EntityRepository {
                //Get class metadata
                $metadata = $entityManager->getClassMetadata($entityName);
 
index bea72239516a4b17cf6916eac5f2c1cbac2fabe8..53ef25527f023a1ea1f0d77d0b2db6c09b343b1b 100644 (file)
@@ -59,6 +59,6 @@ class RapsysBlogBundle extends Bundle {
         */
        public static function getVersion(): string {
                //Return version
-               return '0.0.1';
+               return '0.0.2';
        }
 }
similarity index 92%
rename from Repository/EntityRepository.php
rename to Repository.php
index 9036eca32039ffcc4259e99245c473352e5796c5..493884a894f0fec7a093e4f5a26e08b8f2d5a56e 100644 (file)
@@ -9,10 +9,10 @@
  * file that was distributed with this source code.
  */
 
-namespace Rapsys\BlogBundle\Repository;
+namespace Rapsys\BlogBundle;
 
 use Doctrine\ORM\EntityManagerInterface;
-use Doctrine\ORM\EntityRepository as BaseEntityRepository;
+use Doctrine\ORM\EntityRepository;
 use Doctrine\ORM\Mapping\ClassMetadata;
 use Symfony\Component\Routing\RouterInterface;
 use Symfony\Contracts\Translation\TranslatorInterface;
@@ -24,7 +24,7 @@ use Rapsys\PackBundle\Util\SluggerUtil;
  *
  * {@inheritdoc}
  */
-class EntityRepository extends BaseEntityRepository {
+class Repository extends EntityRepository {
        /**
         * The RouterInterface instance
         *
@@ -85,7 +85,7 @@ class EntityRepository extends BaseEntityRepository {
         * @param array $languages The languages list
         * @param string $locale The current locale
         */
-       public function __construct(EntityManagerInterface $manager, ClassMetadata $class, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator, array $languages, string $locale) {
+       public function __construct(protected EntityManagerInterface $manager, ClassMetadata $class, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator, array $languages, string $locale) {
                //Call parent constructor
                parent::__construct($manager, $class);
 
index 9708751067d9b5005e80b699ec3366cfb5b46278..a8ec9dfce35dfe078e4c3da6575c204a7d583d28 100644 (file)
@@ -13,13 +13,15 @@ namespace Rapsys\BlogBundle\Repository;
 
 use Doctrine\ORM\Query\ResultSetMapping;
 
+use Rapsys\BlogBundle\Repository;
+
 /**
  * ArticleRepository
  *
  * This class was generated by the Doctrine ORM. Add your own custom
  * repository methods below.
  */
-class ArticleRepository extends EntityRepository {
+class ArticleRepository extends Repository {
        /**
         * Find article count as int
         *
@@ -46,7 +48,7 @@ SQL;
                $rsm->addScalarResult('count', 'count', 'integer');
 
                //Get result
-               return $this->_em
+               return $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->getSingleScalarResult();
        }
@@ -101,13 +103,13 @@ SQL;
                        ->addScalarResult('k_ids', 'k_ids', 'string')
                        ->addScalarResult('k_slugs', 'k_slugs', 'string')
                        ->addScalarResult('k_titles', 'k_titles', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime')
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable')
                        ->addIndexByScalar('id');
 
                //Get result
-               $result = $this->_em
+               $result = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('offset', $page * $count)
                        ->setParameter('count', $count)
@@ -226,12 +228,12 @@ SQL;
                        ->addScalarResult('kat_locales', 'kat_locales', 'string')
                        ->addScalarResult('kat_slugs', 'kat_slugs', 'string')
                        ->addScalarResult('kat_titles', 'kat_titles', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime');
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable');
 
                //Get data
-               $data = $this->_em
+               $data = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('id', $id)
                        ->getOneOrNullResult();
index 555f1070f5ad48222f8c99a48c19d11816dd3905..db25c18c4313577732e0b9ff62f63af924702a93 100644 (file)
@@ -13,13 +13,15 @@ namespace Rapsys\BlogBundle\Repository;
 
 use Doctrine\ORM\Query\ResultSetMapping;
 
+use Rapsys\BlogBundle\Repository;
+
 /**
  * KeywordRepository
  *
  * This class was generated by the Doctrine ORM. Add your own custom
  * repository methods below.
  */
-class KeywordRepository extends EntityRepository {
+class KeywordRepository extends Repository {
        /**
         * Find keyword count as int
         *
@@ -46,7 +48,7 @@ SQL;
                $rsm->addScalarResult('count', 'count', 'integer');
 
                //Get result
-               return $this->_em
+               return $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->getSingleScalarResult();
        }
@@ -90,13 +92,13 @@ SQL;
                        ->addScalarResult('description', 'description', 'string')
                        ->addScalarResult('slug', 'slug', 'string')
                        ->addScalarResult('title', 'title', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime')
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable')
                        ->addIndexByScalar('id');
 
                //Get result
-               $result = $this->_em
+               $result = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('offset', $page * $count)
                        ->setParameter('count', $count)
@@ -230,12 +232,12 @@ SQL;
                        ->addScalarResult('ckt_locales', 'ckt_locales', 'string')
                        ->addScalarResult('ckt_slugs', 'ckt_slugs', 'string')
                        ->addScalarResult('ckt_titles', 'ckt_titles', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime');
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable');
 
                //Get data
-               $data = $this->_em
+               $data = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('id', $id)
                        ->getOneOrNullResult();
index 71b6cd1f9f2c9b08d24d2bce73c2f1ae72c6b169..0a385bf8914a9ae5d8d4c4231c7d33dc14b9ab7c 100644 (file)
@@ -12,6 +12,9 @@
 namespace Rapsys\BlogBundle\Repository;
 
 use Doctrine\ORM\Query\ResultSetMapping;
+
+use Rapsys\BlogBundle\Repository;
+
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
 use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
 use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
@@ -19,7 +22,7 @@ use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
 /**
  * UserRepository
  */
-class UserRepository extends EntityRepository implements PasswordUpgraderInterface {
+class UserRepository extends Repository implements PasswordUpgraderInterface {
        /**
         * Find user count as int
         *
@@ -45,7 +48,7 @@ SQL;
                $rsm->addScalarResult('count', 'count', 'integer');
 
                //Get result
-               return $this->_em
+               return $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->getSingleScalarResult();
        }
@@ -151,9 +154,9 @@ SQL;
                        ->addScalarResult('surname', 'surname', 'string')
                        ->addScalarResult('pseudonym', 'pseudonym', 'string')
                        ->addScalarResult('slug', 'slug', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime')
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable')
                        ->addScalarResult('civility', 'civility', 'string')
                        //XXX: is a string because of \n separator
                        ->addScalarResult('g_ids', 'g_ids', 'string')
@@ -175,7 +178,7 @@ SQL;
                        ->addScalarResult('kt_titles', 'kt_titles', 'string');
 
                //Fetch result
-               $res = $this->_em
+               $res = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('offset', $page * $count)
                        ->setParameter('count', $count)
@@ -377,9 +380,9 @@ SQL;
                        ->addScalarResult('surname', 'surname', 'string')
                        ->addScalarResult('pseudonym', 'pseudonym', 'string')
                        ->addScalarResult('slug', 'slug', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime')
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable')
                        ->addScalarResult('civility', 'civility', 'string')
                        //XXX: is a string because of \n separator
                        ->addScalarResult('g_ids', 'g_ids', 'string')
@@ -401,7 +404,7 @@ SQL;
                        ->addScalarResult('kt_titles', 'kt_titles', 'string');
 
                //Get data
-               if (($data = $this->_em
+               if (($data = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('id', $id)
                        ->getOneOrNullResult()) === null) {
diff --git a/config/doctrine/Article.orm.xml b/config/doctrine/Article.orm.xml
new file mode 100644 (file)
index 0000000..ba97ffa
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity repository-class="Rapsys\BlogBundle\Repository\ArticleRepository" name="Rapsys\BlogBundle\Entity\Article" table="articles">
+    <id name="id" type="integer" column="id">
+      <generator strategy="IDENTITY"/>
+    </id>
+    <field name="created" type="datetime" column="created"/>
+    <field name="updated" type="datetime" column="updated"/>
+    <one-to-many field="article_translations" target-entity="Rapsys\BlogBundle\Entity\ArticleTranslation" mapped-by="article" fetch="LAZY"/>
+    <many-to-one field="user" target-entity="Rapsys\BlogBundle\Entity\User" inversed-by="articles" fetch="LAZY">
+      <join-columns>
+        <join-column name="user_id" referenced-column-name="id"/>
+      </join-columns>
+    </many-to-one>
+    <many-to-many field="keywords" target-entity="Rapsys\BlogBundle\Entity\Keyword" inversed-by="articles" fetch="LAZY">
+      <join-table name="articles_keywords">
+        <join-columns>
+          <join-column name="article_id" referenced-column-name="id" on-delete="CASCADE"/>
+        </join-columns>
+        <inverse-join-columns>
+          <join-column name="keyword_id" referenced-column-name="id" on-delete="CASCADE"/>
+        </inverse-join-columns>
+      </join-table>
+    </many-to-many>
+    <lifecycle-callbacks>
+      <lifecycle-callback type="preUpdate" method="preUpdate"/>
+    </lifecycle-callbacks>
+  </entity>
+</doctrine-mapping>
diff --git a/config/doctrine/Article.orm.yml b/config/doctrine/Article.orm.yml
deleted file mode 100644 (file)
index 6efd871..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-Rapsys\BlogBundle\Entity\Article:
-    type: entity
-    repositoryClass: Rapsys\BlogBundle\Repository\ArticleRepository
-    table: articles
-    id:
-        id:
-            type: integer
-            generator:
-                strategy: AUTO
-            options:
-                unsigned: true
-    fields:
-        created:
-            type: datetime
-        updated:
-            type: datetime
-    manyToOne:
-        user:
-            targetEntity: Rapsys\BlogBundle\Entity\User
-            inversedBy: articles
-    manyToMany:
-        keywords:
-            targetEntity: Rapsys\BlogBundle\Entity\Keyword
-            inversedBy: articles
-            joinTable:
-                name: articles_keywords
-    oneToMany:
-        article_translations:
-            targetEntity: Rapsys\BlogBundle\Entity\ArticleTranslation
-            mappedBy: article
-    lifecycleCallbacks:
-        preUpdate: ['preUpdate']
diff --git a/config/doctrine/ArticleTranslation.orm.xml b/config/doctrine/ArticleTranslation.orm.xml
new file mode 100644 (file)
index 0000000..3302d97
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity repository-class="Rapsys\BlogBundle\Repository\ArticleTranslationRepository" name="Rapsys\BlogBundle\Entity\ArticleTranslation" table="articles_translations">
+    <unique-constraints>
+      <unique-constraint name="locale_slug" columns="locale,slug"/>
+    </unique-constraints>
+    <id name="article_id" type="integer" column="article_id"/>
+    <id name="locale" type="string" column="locale" length="5"/>
+    <field name="body" type="text" column="body" nullable="true"/>
+    <field name="description" type="text" column="description" nullable="true"/>
+    <field name="slug" type="string" column="slug" length="128" nullable="true"/>
+    <field name="title" type="string" column="title" length="128" nullable="true"/>
+    <field name="created" type="datetime" column="created"/>
+    <field name="updated" type="datetime" column="updated"/>
+    <many-to-one field="article" target-entity="Rapsys\BlogBundle\Entity\Article" inversed-by="article_translations" fetch="LAZY">
+      <join-columns>
+        <join-column name="article_id" referenced-column-name="id" nullable="false"/>
+      </join-columns>
+    </many-to-one>
+    <lifecycle-callbacks>
+      <lifecycle-callback type="preUpdate" method="preUpdate"/>
+    </lifecycle-callbacks>
+  </entity>
+</doctrine-mapping>
diff --git a/config/doctrine/ArticleTranslation.orm.yml b/config/doctrine/ArticleTranslation.orm.yml
deleted file mode 100644 (file)
index 87ffe4a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-Rapsys\BlogBundle\Entity\ArticleTranslation:
-    type: entity
-    repositoryClass: Rapsys\BlogBundle\Repository\ArticleTranslationRepository
-    table: articles_translations
-    id:
-        article_id:
-            type: integer
-            options:
-                unsigned: true
-        locale:
-            type: string
-            length: 5
-    fields:
-        body:
-            type: text
-            nullable: true
-        description:
-            type: text
-            nullable: true
-        slug:
-            type: string
-            length: 128
-            nullable: true
-        title:
-            type: string
-            length: 128
-            nullable: true
-        created:
-            type: datetime
-        updated:
-            type: datetime
-    manyToOne:
-        article:
-            targetEntity: Rapsys\BlogBundle\Entity\Article
-            inversedBy: article_translations
-            joinColumn:
-                nullable: false
-    uniqueConstraints:
-        locale_slug:
-            columns: [ locale, slug ]
-    lifecycleCallbacks:
-        preUpdate: ['preUpdate']
diff --git a/config/doctrine/Civility.orm.xml b/config/doctrine/Civility.orm.xml
new file mode 100644 (file)
index 0000000..b67753d
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity name="Rapsys\BlogBundle\Entity\Civility" table="civilities" />
+</doctrine-mapping>
diff --git a/config/doctrine/Civility.orm.yml b/config/doctrine/Civility.orm.yml
deleted file mode 100644 (file)
index e0957e8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-Rapsys\BlogBundle\Entity\Civility:
-    type: entity
-    #repositoryClass: Rapsys\BlogBundle\Repository\CivilityRepository
-    table: civilities
-    oneToMany:
-        users:
-            targetEntity: User
-            mappedBy: civility
diff --git a/config/doctrine/Group.orm.xml b/config/doctrine/Group.orm.xml
new file mode 100644 (file)
index 0000000..5711ecb
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity name="Rapsys\BlogBundle\Entity\Group" table="groups" />
+</doctrine-mapping>
diff --git a/config/doctrine/Group.orm.yml b/config/doctrine/Group.orm.yml
deleted file mode 100644 (file)
index ef84ff0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-Rapsys\BlogBundle\Entity\Group:
-    type: entity
-    #repositoryClass: Rapsys\BlogBundle\Repository\GroupRepository
-    table: groups
-    manyToMany:
-        users:
-            targetEntity: Rapsys\BlogBundle\Entity\User
-            mappedBy: groups
diff --git a/config/doctrine/Keyword.orm.xml b/config/doctrine/Keyword.orm.xml
new file mode 100644 (file)
index 0000000..dd89cd0
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity repository-class="Rapsys\BlogBundle\Repository\KeywordRepository" name="Rapsys\BlogBundle\Entity\Keyword" table="keywords">
+    <id name="id" type="integer" column="id">
+      <generator strategy="IDENTITY"/>
+    </id>
+    <field name="created" type="datetime" column="created"/>
+    <field name="updated" type="datetime" column="updated"/>
+    <one-to-many field="keyword_translations" target-entity="Rapsys\BlogBundle\Entity\KeywordTranslation" mapped-by="keyword" fetch="LAZY"/>
+    <many-to-many field="articles" target-entity="Rapsys\BlogBundle\Entity\Article" mapped-by="keywords" fetch="LAZY"/>
+    <lifecycle-callbacks>
+      <lifecycle-callback type="preUpdate" method="preUpdate"/>
+    </lifecycle-callbacks>
+  </entity>
+</doctrine-mapping>
diff --git a/config/doctrine/Keyword.orm.yml b/config/doctrine/Keyword.orm.yml
deleted file mode 100644 (file)
index 86f37b1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Rapsys\BlogBundle\Entity\Keyword:
-    type: entity
-    repositoryClass: Rapsys\BlogBundle\Repository\KeywordRepository
-    table: keywords
-    id:
-        id:
-            type: integer
-            generator:
-                strategy: AUTO
-            options:
-                unsigned: true
-    fields:
-        created:
-            type: datetime
-        updated:
-            type: datetime
-    manyToMany:
-        articles:
-            targetEntity: Rapsys\BlogBundle\Entity\Article
-            mappedBy: keywords
-    oneToMany:
-        keyword_translations:
-            targetEntity: Rapsys\BlogBundle\Entity\KeywordTranslation
-            mappedBy: keyword
-    lifecycleCallbacks:
-        preUpdate: ['preUpdate']
diff --git a/config/doctrine/KeywordTranslation.orm.xml b/config/doctrine/KeywordTranslation.orm.xml
new file mode 100644 (file)
index 0000000..7bf6e9b
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity repository-class="Rapsys\BlogBundle\Repository\KeywordTranslationRepository" name="Rapsys\BlogBundle\Entity\KeywordTranslation" table="keywords_translations">
+    <unique-constraints>
+      <unique-constraint name="locale_slug" columns="locale,slug"/>
+    </unique-constraints>
+    <id name="keyword_id" type="integer" column="keyword_id"/>
+    <id name="locale" type="string" column="locale" length="5"/>
+    <field name="description" type="text" column="description" nullable="true"/>
+    <field name="slug" type="string" column="slug" length="128" nullable="true"/>
+    <field name="title" type="string" column="title" length="128" nullable="true"/>
+    <field name="created" type="datetime" column="created"/>
+    <field name="updated" type="datetime" column="updated"/>
+    <many-to-one field="keyword" target-entity="Rapsys\BlogBundle\Entity\Keyword" inversed-by="keyword_translations" fetch="LAZY">
+      <join-columns>
+        <join-column name="keyword_id" referenced-column-name="id" nullable="false"/>
+      </join-columns>
+    </many-to-one>
+    <lifecycle-callbacks>
+      <lifecycle-callback type="preUpdate" method="preUpdate"/>
+    </lifecycle-callbacks>
+  </entity>
+</doctrine-mapping>
diff --git a/config/doctrine/KeywordTranslation.orm.yml b/config/doctrine/KeywordTranslation.orm.yml
deleted file mode 100644 (file)
index 18cf06e..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-Rapsys\BlogBundle\Entity\KeywordTranslation:
-    type: entity
-    repositoryClass: Rapsys\BlogBundle\Repository\KeywordTranslationRepository
-    table: keywords_translations
-    id:
-        keyword_id:
-            type: integer
-            options:
-                unsigned: true
-        locale:
-            type: string
-            length: 5
-    fields:
-        description:
-            type: text
-            nullable: true
-        slug:
-            type: string
-            length: 128
-            nullable: true
-        title:
-            type: string
-            length: 128
-            nullable: true
-        created:
-            type: datetime
-        updated:
-            type: datetime
-    manyToOne:
-        keyword:
-            targetEntity: Rapsys\BlogBundle\Entity\Keyword
-            inversedBy: keyword_translations
-            joinColumn:
-                nullable: false
-    uniqueConstraints:
-        locale_slug:
-            columns: [ locale, slug ]
-    lifecycleCallbacks:
-        preUpdate: ['preUpdate']
diff --git a/config/doctrine/User.orm.xml b/config/doctrine/User.orm.xml
new file mode 100644 (file)
index 0000000..3b421ec
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity repository-class="Rapsys\BlogBundle\Repository\UserRepository" name="Rapsys\BlogBundle\Entity\User" table="users">
+    <field name="pseudonym" type="string" length="64" nullable="true" />
+    <field name="slug" type="string" length="64" unique="true" nullable="true" />
+    <one-to-many field="articles" target-entity="Rapsys\BlogBundle\Entity\Article" mapped-by="user" fetch="LAZY" />
+    <one-to-many field="user_translations" target-entity="Rapsys\BlogBundle\Entity\UserTranslation" mapped-by="user" fetch="LAZY" />
+       <association-overrides>
+      <association-override name="groups">
+        <join-table name="users_groups">
+          <join-columns>
+            <join-column name="user_id" referenced-column-name="id" />
+          </join-columns>
+          <inverse-join-columns>
+            <join-column name="group_id" referenced-column-name="id" />
+          </inverse-join-columns>
+        </join-table>
+      </association-override>
+       </association-overrides>
+  </entity>
+</doctrine-mapping>
diff --git a/config/doctrine/User.orm.yml b/config/doctrine/User.orm.yml
deleted file mode 100644 (file)
index 913e32d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-Rapsys\BlogBundle\Entity\User:
-    type: entity
-    repositoryClass: Rapsys\BlogBundle\Repository\UserRepository
-    table: users
-    fields:
-        pseudonym:
-            type: string
-            length: 64
-            nullable: true
-        slug:
-            type: string
-            length: 64
-            unique: true
-            nullable: true
-    oneToMany:
-        articles:
-            targetEntity: Rapsys\BlogBundle\Entity\Article
-            mappedBy: user
-        user_translations:
-            targetEntity: Rapsys\BlogBundle\Entity\UserTranslation
-            mappedBy: user
-#    manyToMany:
-#        groups:
-#            targetEntity: Group
-#            inversedBy: users
-#            joinTable:
-#                name: users_groups
-    associationOverride:
-        groups:
-            joinTable:
-                name: users_groups
-                joinColumns:
-                    id:
-                        name: user_id
-                inverseJoinColumns:
-                    id:
-                        name: group_id
diff --git a/config/doctrine/UserTranslation.orm.xml b/config/doctrine/UserTranslation.orm.xml
new file mode 100644 (file)
index 0000000..54a82c1
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity name="Rapsys\BlogBundle\Entity\UserTranslation" table="users_translations">
+    <id name="user_id" type="integer" column="user_id"/>
+    <id name="locale" type="string" column="locale" length="5"/>
+    <field name="description" type="text" column="description" nullable="true"/>
+    <field name="created" type="datetime" column="created"/>
+    <field name="updated" type="datetime" column="updated"/>
+    <many-to-one field="user" target-entity="Rapsys\BlogBundle\Entity\User" inversed-by="user_translations" fetch="LAZY">
+      <join-columns>
+        <join-column name="user_id" referenced-column-name="id" nullable="false"/>
+      </join-columns>
+    </many-to-one>
+    <lifecycle-callbacks>
+      <lifecycle-callback type="preUpdate" method="preUpdate"/>
+    </lifecycle-callbacks>
+  </entity>
+</doctrine-mapping>
diff --git a/config/doctrine/UserTranslation.orm.yml b/config/doctrine/UserTranslation.orm.yml
deleted file mode 100644 (file)
index c074499..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-Rapsys\BlogBundle\Entity\UserTranslation:
-    type: entity
-    #repositoryClass: Rapsys\BlogBundle\Repository\UserTranslationRepository
-    table: users_translations
-    id:
-        user_id:
-            type: integer
-            options:
-                unsigned: true
-        locale:
-            type: string
-            length: 5
-    fields:
-        description:
-            type: text
-            nullable: true
-        created:
-            type: datetime
-        updated:
-            type: datetime
-    manyToOne:
-        user:
-            targetEntity: Rapsys\BlogBundle\Entity\User
-            inversedBy: user_translations
-            joinColumn:
-                nullable: false
-    lifecycleCallbacks:
-        preUpdate: ['preUpdate']
index 09d7ac534b3769cfcc7e820d6392e043235e04ec..69559513ba7c54fda2eaf3f9d9cc7cbf4d2fe471 100644 (file)
@@ -168,13 +168,22 @@ doctrine:
             collate: 'utf8mb4_unicode_ci'
     # Orm configuration
     orm:
-        # Controler resolver
-        controller_resolver:
-            auto_mapping: false
+        # Mapping
+        mappings:
+            RapsysBlogBundle:
+                type: 'xml'
+                prefix: 'Rapsys\BlogBundle\Entity'
+                is_bundle: true
+                dir: 'config/doctrine'
+            RapsysUserBundle:
+                type: 'xml'
+                prefix: 'Rapsys\UserBundle\Entity'
+                is_bundle: true
+                dir: 'config/doctrine'
+
         # Replace repository factory
         repository_factory: 'Rapsys\BlogBundle\Factory\RepositoryFactory'
-
-        #Force resolution of UserBundle entities to BlogBundle one
+        # Force resolution of UserBundle entities to BlogBundle one
         #XXX: without these lines, relations are lookup in parent namespace ignoring BlogBundle extension
         resolve_target_entities:
             Rapsys\UserBundle\Entity\Group: 'Rapsys\BlogBundle\Entity\Group'
index a0ca49f81ba51bfd598d381280e7fdd43ff62946..559da71afcb993672a386462d268911556383693 100644 (file)
                </div>
     </div>
 {%- endblock form_row -%}
+
+{%- block form_start -%}
+    {%- do form.setMethodRendered() -%}
+    {% set method = method|upper %}
+    {%- if method in ["GET", "POST"] -%}
+        {% set form_method = method %}
+    {%- else -%}
+        {% set form_method = "POST" %}
+    {%- endif -%}
+    <form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}>
+    {%- if form_method != method -%}
+        <input type="hidden" name="_method" value="{{ method }}" />
+    {%- endif -%}
+    {%- if errors|length > 0 -%}
+        <header class="message error">
+                       {{- form_errors(form) -}}
+        </header>
+    {%- endif -%}
+{%- endblock form_start -%}
index ac89ff21dad1f493112c7029c516649b6a176bc0..11c3b9ecb63e003e1ee2c5df474e82e1c468519b 100644 (file)
@@ -2,7 +2,7 @@
 {% block content %}
        <section class="form">
                <header>
-                       <h2><a href="{{ path('rapsysuser_register') }}">{{ title }}</a></h2>
+                       <h2><a href="{{ path('rapsysuser_register') }}">{{ title.page }}</a></h2>
                </header>
                <section>
                        {% if disabled is defined and disabled %}