Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Fcm\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\ORM\Events;
- use Doctrine\ORM\Mapping\ManyToOne;
- /**
- * @ORM\Table(name="campaign")
- * @ORM\Entity(repositoryClass="Fcm\Entity\Repository\CampaignRepository")
- * @ORM\HasLifecycleCallbacks
- * @property integer $id
- * @property string $name
- * @property string $status
- * @property string $expectedClose
- * @property integer $typeCampaign
- * @property integer $appId
- * @property string $appSecret
- * @property string $appUrl
- * @property string $appUrl
- * @property string $cssFileUrl
- * @property string $imgFileUrl
- * @property date $created
- * @property date $updated
- */
- class Campaign
- {
- /**
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- * @ORM\Column(type="integer")
- */
- protected $id;
- /** @ORM\Column(type="string", length=120, nullable=false) */
- protected $name;
- /** @ORM\Column(type="boolean", nullable=false) */
- protected $status;
- /** @ORM\Column(type="date", nullable=false) */
- protected $startDate;
- /** @ORM\Column(type="date", nullable=false) */
- protected $endDate;
- /** @ORM\Column(type="bigint", unique=false, nullable=false) */
- protected $appId;
- /** @ORM\Column(type="string",length=125, nullable=true, unique=false) */
- protected $appSecret;
- /** @ORM\Column(type="string",length=125, nullable=true, unique=false) */
- protected $appUrl;
- /** @ORM\Column(type="text", nullable=true, unique=false) */
- protected $content_landing_textarea;
- /** @ORM\Column(type="text", nullable=true, unique=false) */
- protected $content_enter_textarea;
- /** @ORM\Column(type="text", nullable=true, unique=false) */
- protected $content_term_policy;
- /** @ORM\Column(type="text", nullable=true, unique=false) */
- protected $content_thank_you;
- /** @ORM\Column(type="string",length=200,nullable=true, unique=false) */
- protected $share_title;
- /** @ORM\Column(type="string",length=200, nullable=true, unique=false) */
- protected $share_subtitle;
- /** @ORM\Column(type="string",length=200, nullable=true, unique=false) */
- protected $share_desc;
- /** @ORM\Column(type="bigint", unique=false, nullable=false) */
- protected $version;
- /**
- * @ORM\ManyToOne(targetEntity="Client",inversedBy="campaigns")
- * @ORM\JoinColumn(onDelete="CASCADE")
- */
- protected $client;
- /** @ORM\OneToMany(targetEntity="Response", mappedBy="campaign", cascade={"remove"}) */
- protected $responses;
- /**
- * @ORM\OneToOne(targetEntity="Asset", mappedBy="campaign",cascade={"remove"})
- */
- protected $assets;
- /**
- * @ORM\OneToOne(targetEntity="AnswerQuestion", mappedBy="campaign", cascade={"remove"})
- */
- protected $answer_question;
- /**
- * @ORM\OneToOne(targetEntity="Draw", mappedBy="campaign", cascade={"persist", "remove"})
- */
- protected $draw;
- /**
- * @ORM\OneToOne(targetEntity="DesiredField", mappedBy="campaign", cascade={"remove"})
- */
- protected $desired_field;
- /**
- * @ORM\OneToOne(targetEntity="MultipleChoice", mappedBy="campaign", cascade={"remove"})
- */
- protected $multiple_choice;
- /**
- * @ORM\ManyToOne(targetEntity="TypeCampaign", inversedBy="campaign")
- */
- protected $typeCampaign;
- /**
- * @var date $created
- *
- * @ORM\Column(name="created", type="date", nullable=false)
- */
- protected $created;
- /**
- * @var date $updated
- *
- * @ORM\Column(name="updated", type="date", nullable=false)
- */
- protected $updated;
- /**
- * Magic getter to expose protected properties.
- *
- * @param string $property
- * @return mixed
- */
- public function __get($property)
- {
- return $this->$property;
- }
- /**
- * Magic setter to save protected properties.
- *
- * @param string $property
- * @param mixed $value
- */
- public function __set($property, $value)
- {
- $this->$property = $value;
- }
- /**
- * Convert the object to an array.
- *
- * @return array
- */
- public function getArrayCopy()
- {
- return get_object_vars($this);
- }
- /**
- * Populate from entity to array an array.
- *
- * @param array $data
- */
- public function toArray()
- {
- $data = array(
- 'fsInfoCampaign' => array(
- 'id' => $this->id,
- 'name' => $this->name,
- 'status' => $this->status,
- 'startdate' => $this->startDate->format('Y-m-d'),
- 'enddate' => $this->endDate->format('Y-m-d'),
- 'typecampaign' => $this->typeCampaign->type,
- 'typecampaignid' => $this->typeCampaign->id,
- 'client' => $this->client->name,
- 'clientid' => $this->client->id,
- 'version' => $this->version
- ),
- 'fsFB' => array(
- 'appid' => $this->appId,
- 'appsecret' => $this->appSecret,
- 'appurl' => $this->appUrl,
- 'landing_textarea' => $this->content_landing_textarea,
- 'enter_textarea' => $this->content_enter_textarea,
- 'term_privacy_textarea' => $this->content_term_policy,
- 'thank_you_textarea' => $this->content_thank_you,
- 'title_share_Text' => $this->share_title,
- 'subtitle_share_text' => $this->share_subtitle,
- 'desc_share_textarea' => $this->share_desc,
- ),
- );
- return $data;
- }
- /**
- * Populate from an array.
- *
- * @param array $data
- */
- public function populate($data = array())
- {
- // fsInfoCampaign
- $this->name = $data['fsInfoCampaign']['name'];
- $this->status = $data['fsInfoCampaign']['status'];
- $this->startDate = new \DateTime($data['fsInfoCampaign']['startdate']);
- $this->endDate = new \DateTime($data['fsInfoCampaign']['enddate']);
- $this->client = $data['fsInfoCampaign']['client'];
- $this->typeCampaign = $data['fsInfoCampaign']['typecampaign'];
- $this->version = $data['fsInfoCampaign']['version'];
- // fsFB
- $this->appId = $data['fsFB']['appid'];
- $this->appSecret = $data['fsFB']['appsecret'];
- $this->appUrl = $data['fsFB']['appurl'];
- $this->content_landing_textarea = $data['fsFB']['landing_textarea'];
- $this->content_enter_textarea = $data['fsFB']['enter_textarea'];
- $this->content_term_policy = $data['fsFB']['term_privacy_textarea'];
- $this->content_thank_you = $data['fsFB']['thank_you_textarea'];
- $this->share_title = $data['fsFB']['title_share_Text'];
- $this->share_subtitle = $data['fsFB']['subtitle_share_text'];
- $this->share_desc = $data['fsFB']['desc_share_textarea'];
- }
- /** @ORM\PrePersist */
- public function onPrePersist()
- {
- $this->created = $this->updated = new \DateTime('now');
- }
- /** @ORM\PreUpdate */
- public function onPreUpdate()
- {
- $this->updated = new \DateTime('now');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement