]> Raphaël G. Git Repositories - blogbundle/commitdiff
Add group, user and user translation doctrine orm config
authorRaphaël Gertz <git@rapsys.eu>
Fri, 10 Nov 2023 12:30:56 +0000 (13:30 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Fri, 10 Nov 2023 12:32:56 +0000 (13:32 +0100)
Resources/config/doctrine/Group.orm.yml [new file with mode: 0644]
Resources/config/doctrine/User.orm.yml [new file with mode: 0644]
Resources/config/doctrine/UserTranslation.orm.yml [new file with mode: 0644]

diff --git a/Resources/config/doctrine/Group.orm.yml b/Resources/config/doctrine/Group.orm.yml
new file mode 100644 (file)
index 0000000..ef84ff0
--- /dev/null
@@ -0,0 +1,8 @@
+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/Resources/config/doctrine/User.orm.yml b/Resources/config/doctrine/User.orm.yml
new file mode 100644 (file)
index 0000000..913e32d
--- /dev/null
@@ -0,0 +1,37 @@
+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/Resources/config/doctrine/UserTranslation.orm.yml b/Resources/config/doctrine/UserTranslation.orm.yml
new file mode 100644 (file)
index 0000000..c074499
--- /dev/null
@@ -0,0 +1,28 @@
+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']