Completed
Pull Request — master (#374)
by Leny
06:25
created

ViewTranslation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
namespace Victoire\Bundle\I18nBundle\Entity;
3
4
use Doctrine\ORM\Mapping as ORM;
5
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;
6
7
/**
8
 * @ORM\Entity
9
 * @ORM\Table(name="vic_view_translations",
10
 *     uniqueConstraints={@ORM\UniqueConstraint(name="lookup_unique_idx", columns={
11
 *         "locale", "object_id", "field"
12
 *     })}
13
 * )
14
 */
15
class ViewTranslation extends AbstractPersonalTranslation
16
{
17
    /**
18
     * Convenient constructor
19
     *
20
     * @param string $locale
21
     * @param string $field
22
     * @param string $value
23
     */
24
    public function __construct($locale = null, $field = null, $value = null)
25
    {
26
        $this->setLocale($locale);
27
        $this->setField($field);
28
        $this->setContent($value);
29
    }
30
31
    /**
32
     * @ORM\ManyToOne(targetEntity="Victoire\Bundle\CoreBundle\Entity\View", inversedBy="translations")
33
     * @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
34
     */
35
    protected $object;
36
}