Skip to content

Instantly share code, notes, and snippets.

@enricostano
Created June 6, 2012 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enricostano/2882371 to your computer and use it in GitHub Desktop.
Save enricostano/2882371 to your computer and use it in GitHub Desktop.
Vocabulary entity
<?php
namespace StanoSas\Bundle\TaxonomyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* StanoSas\Bundle\TaxonomyBundle\Entity\Vocabulary
*
* @ORM\Table()
* @ORM\Entity
*/
class Vocabulary
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $name
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var string $slug
*
* @ORM\Column(name="slug", type="string", length=255)
*/
private $slug;
/**
* @ORM\OneToMany(targetEntity="Term", mappedBy="vocabulary")
*/
private $terms;
public function __construct()
{
$this->terms = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set slug
*
* @param string $slug
*/
public function setSlug($slug)
{
$this->slug = $slug;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Add terms
*
* @param StanoSas\Bundle\TaxonomyBundle\Entity\Term $terms
*/
public function addTerm(\StanoSas\Bundle\TaxonomyBundle\Entity\Term $terms)
{
$this->terms[] = $terms;
}
/**
* Get terms
*
* @return Doctrine\Common\Collections\Collection
*/
public function getTerms()
{
return $this->terms;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment