Skip to content

Instantly share code, notes, and snippets.

@tristanbes
Created July 27, 2012 14:22
Show Gist options
  • Save tristanbes/3188297 to your computer and use it in GitHub Desktop.
Save tristanbes/3188297 to your computer and use it in GitHub Desktop.
<?php
namespace AwesomeNamespace\AwesomeBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* AwesomeNamespace\AwesomeBundle\Entity\Profile
*
* @ORM\Table(name="profile")
* @ORM\Entity
* @Gedmo\TranslationEntity(class="AwesomeNamespace\AwesomeBundle\Entity\ProfileTranslation")
*/
class Profile
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Gedmo\Translatable
* @ORM\Column(name="name", type="string", length=255)
*/
protected $name;
/**
* @var text $description
* @Gedmo\Translatable
* @ORM\Column(name="description", type="text")
*/
protected $description;
/**
* @ORM\OneToMany(targetEntity="ProfileTranslation", mappedBy="object", cascade={"persist", "remove"})
*/
protected $translations;
/**
* Required for Translatable behaviour
* @Gedmo\Locale
*/
protected $locale;
public function __construct()
{
$this->translations = new ArrayCollection;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
public function getLocale()
{
return $this->locale;
}
public function setLocale($locale)
{
$this->locale = $locale;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function getTranslations()
{
return $this->translations;
}
public function addTranslation(ProfileTranslation $t)
{
$this->translations->add($t);
$t->setObject($this);
}
public function removeTranslation(ProfileTranslation $t)
{
$this->translations->removeElement($t);
}
public function setTranslations($translations)
{
$this->translations = $translations;
}
public function __toString()
{
return $this->getName();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment