klein0r/affiliate-dashboard

View on GitHub
src/AffiliateDashboardBundle/Entity/Tag.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace AffiliateDashboardBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Tag
 *
 * @ORM\Table(name="tag")
 * @ORM\Entity(repositoryClass="AffiliateDashboardBundle\Repository\TagRepository")
 */
class Tag
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255, unique=true)
     */
    private $name;

    /**
     * @var ArrayCollection
     *
     * @ORM\OneToMany(targetEntity="Blogpost" , mappedBy="affiliateTag" , cascade={"all"})
     */
    private $blogposts;

    /**
     * @var ArrayCollection
     *
     * @ORM\OneToMany(targetEntity="Sale" , mappedBy="affiliateTag" , cascade={"all"})
     */
    private $sales;

    function __construct()
    {
        $this->blogposts = new ArrayCollection();
        $this->sales = new ArrayCollection();
    }

    /**
     * @return string
     */
    function __toString()
    {
        return $this->getName();
    }

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     *
     * @return Tag
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @return mixed
     */
    public function getBlogposts()
    {
        return $this->blogposts;
    }

    /**
     * @param mixed $blogposts
     */
    public function setBlogposts($blogposts)
    {
        $this->blogposts = $blogposts;
    }

    /**
     * @return mixed
     */
    public function getSales()
    {
        return $this->sales;
    }

    /**
     * @param mixed $sales
     */
    public function setSales($sales)
    {
        $this->sales = $sales;
    }
}