/**
* Modified DateTime
*/
- protected \DateTime $modified;
+ protected \DateTimeImmutable $modified;
/**
* Page integer
*
* {@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();
$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
//Without keywords
} else {
//Set empty modified
- $this->modified = new \DateTime('-1 year');
+ $this->modified = new \DateTimeImmutable('-1 year');
}
//Create response
//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();
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;
/**
* {@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);
* @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);
*/
public static function getVersion(): string {
//Return version
- return '0.0.1';
+ return '0.0.2';
}
}
* 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;
*
* {@inheritdoc}
*/
-class EntityRepository extends BaseEntityRepository {
+class Repository extends EntityRepository {
/**
* The RouterInterface instance
*
* @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);
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
*
$rsm->addScalarResult('count', 'count', 'integer');
//Get result
- return $this->_em
+ return $this->manager
->createNativeQuery($req, $rsm)
->getSingleScalarResult();
}
->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)
->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();
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
*
$rsm->addScalarResult('count', 'count', 'integer');
//Get result
- return $this->_em
+ return $this->manager
->createNativeQuery($req, $rsm)
->getSingleScalarResult();
}
->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)
->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();
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;
/**
* UserRepository
*/
-class UserRepository extends EntityRepository implements PasswordUpgraderInterface {
+class UserRepository extends Repository implements PasswordUpgraderInterface {
/**
* Find user count as int
*
$rsm->addScalarResult('count', 'count', 'integer');
//Get result
- return $this->_em
+ return $this->manager
->createNativeQuery($req, $rsm)
->getSingleScalarResult();
}
->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')
->addScalarResult('kt_titles', 'kt_titles', 'string');
//Fetch result
- $res = $this->_em
+ $res = $this->manager
->createNativeQuery($req, $rsm)
->setParameter('offset', $page * $count)
->setParameter('count', $count)
->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')
->addScalarResult('kt_titles', 'kt_titles', 'string');
//Get data
- if (($data = $this->_em
+ if (($data = $this->manager
->createNativeQuery($req, $rsm)
->setParameter('id', $id)
->getOneOrNullResult()) === null) {
--- /dev/null
+<?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>
+++ /dev/null
-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']
--- /dev/null
+<?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>
+++ /dev/null
-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']
--- /dev/null
+<?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>
+++ /dev/null
-Rapsys\BlogBundle\Entity\Civility:
- type: entity
- #repositoryClass: Rapsys\BlogBundle\Repository\CivilityRepository
- table: civilities
- oneToMany:
- users:
- targetEntity: User
- mappedBy: civility
--- /dev/null
+<?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>
+++ /dev/null
-Rapsys\BlogBundle\Entity\Group:
- type: entity
- #repositoryClass: Rapsys\BlogBundle\Repository\GroupRepository
- table: groups
- manyToMany:
- users:
- targetEntity: Rapsys\BlogBundle\Entity\User
- mappedBy: groups
--- /dev/null
+<?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>
+++ /dev/null
-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']
--- /dev/null
+<?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>
+++ /dev/null
-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']
--- /dev/null
+<?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>
+++ /dev/null
-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
--- /dev/null
+<?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>
+++ /dev/null
-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']
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'
</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 -%}
{% 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 %}