Skip to content

Instantly share code, notes, and snippets.

@nischalsource
Created May 19, 2015 13:58
Show Gist options
  • Save nischalsource/22ab12843cb8d6523502 to your computer and use it in GitHub Desktop.
Save nischalsource/22ab12843cb8d6523502 to your computer and use it in GitHub Desktop.
Usage Entity
<?php
namespace CampaignTool\CampaignToolBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Usage
*
* @ORM\Table(name="campaign_data.usage", indexes={@ORM\Index(name="usage_fk_usage_category1_idx", columns={"category_id"})})
* @ORM\Entity(repositoryClass="CampaignTool\CampaignToolBundle\Entity\UsageRepository")
*/
class Usage
{
public function __construct() {
//$this->telephoneNumbers = new ArrayCollection();
$this->campaignAliases = new ArrayCollection();
}
public function __toString()
{
return $this->name;
}
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="usage_seq", allocationSize=1, initialValue=1)
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="quality", type="integer", nullable=true)
*/
private $quality;
/**
* @var string
*
* @ORM\Column(name="comment", type="string", length=45, nullable=true)
*/
private $comment;
/**
* @var integer
*
*/
private $categoryId;
/**
* @var string
*
* @ORM\Column(name="act", type="string", length=10, nullable=false)
*/
private $act = 'act_seq';
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=500, nullable=false)
*/
private $name;
/**
* @var array
*
* @ORM\OneToMany(targetEntity="Telephone", mappedBy="usage")
*
*/
private $telephoneNumbers;
/**
* @var CostGroup
*
* @ORM\ManyToOne(targetEntity="CostGroup")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="cost_group", referencedColumnName="id")
* })
*/
private $costGroup;
/**
* @var array
*
* @ORM\OneToMany(targetEntity="CampaignAlias", mappedBy="usage")
*/
private $campaignAliases;
private $entityMarketingChannel;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set id
*
* @return string
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get id
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set act
*
* @param string $act
* @return usage
*/
public function setAct($act)
{
$this->act = $act;
return $this;
}
/**
* Get act
*
* @return string
*/
public function getAct()
{
return $this->act;
}
/**
* Set quality
*
* @param integer $quality
* @return usage
*/
public function setQuality($quality)
{
$this->quality = $quality;
return $this;
}
/**
* Get quality
*
* @return integer
*/
public function getQuality()
{
return $this->quality;
}
/**
* Set comment
*
* @param string $comment
* @return usage
*/
public function setComment($comment)
{
$this->comment = $comment;
return $this;
}
/**
* Get comment
*
* @return string
*/
public function getComment()
{
return $this->comment;
}
/**
* Set categoryId
*
* @param integer $categoryId
* @return usage
*/
public function setCategoryId($categoryId)
{
$this->categoryId = $categoryId;
return $this;
}
/**
* Get categoryId
*
* @return integer
*/
public function getCategoryId()
{
return $this->categoryId;
}
/**
* Set telephoneNumbers
*
* @param mixed $telephoneNumber
* @return usage
*/
public function setTelephoneNumbers($telephoneNumbers)
{
$this->telephoneNumbers = $telephoneNumbers;
//You have to update the association-field on the owning side to persist the relation.
//http://doctrine-orm.readthedocs.org/en/latest/reference/unitofwork-associations.html#bidirectional-associations
if(!is_null($telephoneNumbers))
{
foreach($telephoneNumbers as $telephoneNumber)
{
$telephoneNumber->setUsage($this);
}
}
else
{
}
return $this;
}
/**
* Get telephoneNumbers
*
* @return array
*/
public function getTelephoneNumbers()
{
return $this->telephoneNumbers;
}
/**
* Set costGroup
*
* @param \CampaignTool\CampaignToolBundle\Entity\CostGroup $costGroup
* @return controllingChannel
*/
public function setCostGroup(\CampaignTool\CampaignToolBundle\Entity\CostGroup $costGroup = null)
{
$this->costGroup = $costGroup;
return $this;
}
/**
* Get costGroup
*
* @return \CampaignTool\CampaignToolBundle\Entity\CostGroup
*/
public function getCostGroup()
{
return $this->costGroup;
}
/**
* Set campaignAliases
*
* @param mixed $campaignAliases
* @return usage
*/
public function setcampaignAliases($campaignaliases)
{
$this->campaignAliases = $campaignaliases;
//You have to update the association-field on the owning side to persist the relation.
//http://doctrine-orm.readthedocs.org/en/latest/reference/unitofwork-associations.html#bidirectional-associations
if(!is_null($campaignaliases) && is_array($campaignaliases))
{
foreach($campaignaliases as $campaignalias)
{
$campaignalias->setUsage($this);
}
}
return $this;
}
/**
* Get campaignAliases
*
* @return array
*/
public function getcampaignAliases()
{
return $this->campaignAliases;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment