]> Raphaël G. Git Repositories - blogbundle/commitdiff
Remove language relation
authorRaphaël Gertz <git@rapsys.eu>
Fri, 10 Nov 2023 12:26:22 +0000 (13:26 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Fri, 10 Nov 2023 12:28:41 +0000 (13:28 +0100)
Set nullable slug
Add locale field
Add preUpdate callback

Resources/config/doctrine/ArticleTranslation.orm.yml

index 5c581bf54f05123d4fe8d0c841008df7a934be12..87ffe4a510921dbcc17d0bcbc496422112929a3c 100644 (file)
@@ -7,21 +7,24 @@ Rapsys\BlogBundle\Entity\ArticleTranslation:
             type: integer
             options:
                 unsigned: true
-        language_id:
-            type: smallint
-            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
-        description:
-            type: text
-        body:
-            type: text
+            nullable: true
         created:
             type: datetime
         updated:
@@ -30,9 +33,10 @@ Rapsys\BlogBundle\Entity\ArticleTranslation:
         article:
             targetEntity: Rapsys\BlogBundle\Entity\Article
             inversedBy: article_translations
-        language:
-            targetEntity: Rapsys\BlogBundle\Entity\Language
-            inversedBy: article_translations
+            joinColumn:
+                nullable: false
     uniqueConstraints:
-        slug_language:
-            columns: [ slug, language_id ]
+        locale_slug:
+            columns: [ locale, slug ]
+    lifecycleCallbacks:
+        preUpdate: ['preUpdate']