Skip to content

Commit 5d08408

Browse files
author
Roderik van der Veer
committed
Merge pull request #38 from Kunstmaan/db_indexes
performance improvements: added db indexes + more strict field types
2 parents 3af9334 + 892c0f1 commit 5d08408

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Entity/Translation.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Kunstmaan\TranslatorBundle\Entity;
34

45
use Doctrine\ORM\Mapping as ORM;
@@ -7,12 +8,12 @@
78
/**
89
* @ORM\Entity(repositoryClass="Kunstmaan\TranslatorBundle\Repository\TranslationRepository")
910
* @ORM\Table(
10-
* name="kuma_translation",
11-
* uniqueConstraints={
12-
* @ORM\UniqueConstraint(name="keyword_per_locale", columns={"keyword", "locale", "domain"}),
13-
* @ORM\UniqueConstraint(name="translation_id_per_locale", columns={"translation_id", "locale"}),
14-
* },
15-
* indexes={@ORM\Index(name="domain_idx",columns={"domain"}),@ORM\Index(name="locale_idx",columns={"locale"})}
11+
* name="kuma_translation",
12+
* uniqueConstraints={
13+
* @ORM\UniqueConstraint(name="keyword_per_locale", columns={"keyword", "locale", "domain"}),
14+
* @ORM\UniqueConstraint(name="translation_id_per_locale", columns={"translation_id", "locale"}),
15+
* },
16+
* indexes={@ORM\Index(name="idx_locale_domain", columns={"locale", "domain"})}
1617
* )
1718
* @ORM\HasLifecycleCallbacks
1819
*/
@@ -45,15 +46,15 @@ class Translation
4546
/**
4647
* The translations keyword to use in your template or call from the translator
4748
*
48-
* @ORM\Column(type="string")
49+
* @ORM\Column(type="string", length=5)
4950
* @Assert\NotBlank()
5051
*/
5152
protected $locale;
5253

5354
/**
5455
* Location where the translation comes from
5556
*
56-
* @ORM\Column(type="string", nullable=true)
57+
* @ORM\Column(type="string", length=50, nullable=true)
5758
*/
5859
protected $file;
5960

@@ -67,7 +68,7 @@ class Translation
6768
protected $text;
6869

6970
/**
70-
* @ORM\Column(type="string")
71+
* @ORM\Column(type="string", length=30)
7172
* @Assert\NotBlank()
7273
*/
7374
protected $domain;
@@ -87,12 +88,11 @@ class Translation
8788
protected $updatedAt;
8889

8990
/**
90-
*
9191
* A flag which defines the status of a specific translations ('updated', 'new', ..)
9292
*
9393
* @var string
9494
*
95-
* @ORM\Column(type="string", nullable=true)
95+
* @ORM\Column(type="string", length=20, nullable=true)
9696
*/
9797
protected $flag = null;
9898

0 commit comments

Comments
 (0)