Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace SciForum\Version2Bundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Validator\Mapping\ClassMetadata;
- use Symfony\Component\Validator\Constraints\NotBlank;
- use Symfony\Component\Validator\Constraints\MinLength;
- use Symfony\Component\Validator\Constraints\MaxLength;
- /**
- * @ORM\Entity(repositoryClass="SciForum\Version2Bundle\Repository\SubmissionRepository")
- * @ORM\Table(name="submission")
- * @ORM\HasLifecycleCallbacks()
- */
- class Submission
- {
- /**
- * @ORM\Column(name="`id`", type="integer", unique=true, nullable=true)
- */
- protected $id;
- /**
- * @ORM\Id
- * @ORM\Column(name="`hash_key`", type="text", unique=true)
- */
- protected $hash_key;
- /**
- * @ORM\Column(type="integer")
- */
- protected $user_id;
- /**
- * @ORM\Column(type="integer")
- */
- protected $page_id;
- /**
- * @ORM\Column(type="integer")
- */
- protected $conference_id;
- /**
- * @ORM\Column(type="integer")
- */
- protected $section_id;
- /**
- * @ORM\Column(type="text")
- */
- protected $title;
- /**
- * @ORM\Column(type="text")
- */
- protected $abstract;
- /**
- * @ORM\Column(type="text")
- */
- protected $keywords;
- /**
- * @ORM\Column(type="integer")
- */
- protected $status_id;
- /**
- * @ORM\ManyToOne(targetEntity="PaperState", inversedBy="submission_states")
- * @ORM\JoinColumn(name="status_id", referencedColumnName="id")
- */
- protected $state;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $last_action;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $submission_date;
- /**
- * @ORM\OneToOne(targetEntity="SubmissionPage", mappedBy="submission")
- */
- protected $page;
- /**
- * @ORM\ManyToOne(targetEntity="Conference", inversedBy="submissions")
- * @ORM\JoinColumn(name="conference_id", referencedColumnName="id")
- */
- protected $conference;
- /**
- * @ORM\ManyToOne(targetEntity="Section", inversedBy="submission")
- * @ORM\JoinColumn(name="section_id", referencedColumnName="id")
- **/
- protected $section;
- /**
- * @ORM\OneToMany(targetEntity="SubmissionAuthor", mappedBy="submission")
- * @ORM\OrderBy({"sortings" = "ASC"})
- */
- protected $authors;
- /**
- * @ORM\OneToMany(targetEntity="SubmissionHistory", mappedBy="submission")
- */
- protected $histories;
- /**
- * @ORM\ManyToOne(targetEntity="User", inversedBy="submissions")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
- */
- protected $user;
- /**
- * @ORM\OneToOne(targetEntity="Paper", inversedBy="submission")
- * @ORM\JoinColumn(name="id", referencedColumnName="id")
- */
- protected $paper;
- public function __construct()
- {
- $randNbr = rand();
- $this->hash_key = md5( time() * $randNbr );
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set hash_key
- *
- * @param text $hashKey
- */
- public function setHashKey($hashKey)
- {
- $this->hash_key = $hashKey;
- }
- /**
- * Get hash_key
- *
- * @return text
- */
- public function getHashKey()
- {
- return $this->hash_key;
- }
- /**
- * Set user_id
- *
- * @param integer $userId
- */
- public function setUserId($userId)
- {
- $this->user_id = $userId;
- }
- /**
- * Get user_id
- *
- * @return integer
- */
- public function getUserId()
- {
- return $this->user_id;
- }
- /**
- * Set page_id
- *
- * @param integer $pageId
- */
- public function setPageId($pageId)
- {
- $this->page_id = $pageId;
- }
- /**
- * Get page_id
- *
- * @return integer
- */
- public function getPageId()
- {
- return $this->page_id;
- }
- /**
- * Set conference_id
- *
- * @param integer $conferenceId
- */
- public function setConferenceId($conferenceId)
- {
- $this->conference_id = $conferenceId;
- }
- /**
- * Get conference_id
- *
- * @return integer
- */
- public function getConferenceId()
- {
- return $this->conference_id;
- }
- /**
- * Set section_id
- *
- * @param integer $sectionId
- */
- public function setSectionId($sectionId)
- {
- $this->section_id = $sectionId;
- }
- /**
- * Get section_id
- *
- * @return integer
- */
- public function getSectionId()
- {
- return $this->section_id;
- }
- /**
- * Set title
- *
- * @param text $title
- */
- public function setTitle($title)
- {
- $title = trim( $title );
- $this->title = $title;
- }
- /**
- * Get title
- *
- * @return text
- */
- public function getTitle()
- {
- return $this->title;
- }
- /**
- * Set abstract
- *
- * @param text $abstract
- */
- public function setAbstract($abstract)
- {
- $abstract = trim( $abstract );
- $this->abstract = $abstract;
- }
- /**
- * Get abstract
- *
- * @return text
- */
- public function getAbstract()
- {
- return $this->abstract;
- }
- /**
- * Set keywords
- *
- * @param text $keywords
- */
- public function setKeywords($keywords)
- {
- $keywords = trim( $keywords );
- $this->keywords = $keywords;
- }
- /**
- * Get keywords
- *
- * @return text
- */
- public function getKeywords()
- {
- return $this->keywords;
- }
- /**
- * Set status_id
- *
- * @param integer $statusId
- */
- public function setStatusId($statusId)
- {
- $this->status_id = $statusId;
- }
- /**
- * Get status_id
- *
- * @return integer
- */
- public function getStatusId()
- {
- return $this->status_id;
- }
- /**
- * Set last_action
- *
- * @param datetime $lastAction
- */
- public function setLastAction($lastAction)
- {
- $this->last_action = $lastAction;
- }
- /**
- * Get last_action
- *
- * @return datetime
- */
- public function getLastAction()
- {
- return $this->last_action;
- }
- /**
- * Set submission_date
- *
- * @param datetime $submissionDate
- */
- public function setSubmissionDate($submissionDate)
- {
- $this->submission_date = $submissionDate;
- }
- /**
- * Get submission_date
- *
- * @return datetime
- */
- public function getSubmissionDate()
- {
- return $this->submission_date;
- }
- /**
- * Set id
- *
- * @param integer $id
- */
- public function setId($id)
- {
- $this->id = $id;
- }
- /**
- * Set page
- *
- * @param SciForum\Version2Bundle\Entity\SubmissionPage $page
- */
- public function setPage(\SciForum\Version2Bundle\Entity\SubmissionPage $page)
- {
- $this->page = $page;
- }
- /**
- * Get page
- *
- * @return SciForum\Version2Bundle\Entity\SubmissionPage
- */
- public function getPage()
- {
- return $this->page;
- }
- /**
- * Set conference
- *
- * @param SciForum\Version2Bundle\Entity\Conference $conference
- */
- public function setConference(\SciForum\Version2Bundle\Entity\Conference $conference)
- {
- $this->conference = $conference;
- }
- /**
- * Get conference
- *
- * @return SciForum\Version2Bundle\Entity\Conference
- */
- public function getConference()
- {
- return $this->conference;
- }
- /**
- * Set section
- *
- * @param SciForum\Version2Bundle\Entity\Section $section
- */
- public function setSection(\SciForum\Version2Bundle\Entity\Section $section)
- {
- $this->section = $section;
- }
- /**
- * Get section
- *
- * @return SciForum\Version2Bundle\Entity\Section
- */
- public function getSection()
- {
- return $this->section;
- }
- public static function loadValidatorMetadata(ClassMetadata $metadata)
- {
- $title_blank = new NotBlank();
- $title_min = new MinLength(4);
- $abstract_blank = new NotBlank();
- $abstract_min = new MinLength(10);
- $title_blank->message = "The title should not be blank";
- $title_min->message = "The title is too short. It should have {{ limit }} characters or more";
- $abstract_blank->message = "The abstract should not be blank";
- $abstract_min->message = "The abstract is too short. It should have {{ limit }} characters or more";
- $metadata->addPropertyConstraint('title', $title_blank);
- $metadata->addPropertyConstraint('title', $title_min);
- $metadata->addPropertyConstraint('abstract', $abstract_blank);
- $metadata->addPropertyConstraint('abstract', $abstract_min );
- }
- /**
- * Add authors
- *
- * @param SciForum\Version2Bundle\Entity\SubmissionAuthor $authors
- */
- public function addSubmissionAuthor(\SciForum\Version2Bundle\Entity\SubmissionAuthor $authors)
- {
- $this->authors[] = $authors;
- }
- /**
- * Set state
- *
- * @param SciForum\Version2Bundle\Entity\PaperState $state
- */
- public function setState(\SciForum\Version2Bundle\Entity\PaperState $state)
- {
- $this->state = $state;
- }
- /**
- * Get state
- *
- * @return SciForum\Version2Bundle\Entity\PaperState
- */
- public function getState()
- {
- return $this->state;
- }
- /**
- * Set user
- *
- * @param SciForum\Version2Bundle\Entity\User $user
- */
- public function setUser(\SciForum\Version2Bundle\Entity\User $user)
- {
- $this->user = $user;
- }
- /**
- * Get user
- *
- * @return SciForum\Version2Bundle\Entity\User
- */
- public function getUser()
- {
- return $this->user;
- }
- /**
- * Add histories
- *
- * @param SciForum\Version2Bundle\Entity\SubmissionHistory $histories
- */
- public function addSubmissionHistory(\SciForum\Version2Bundle\Entity\SubmissionHistory $histories)
- {
- $this->histories[] = $histories;
- }
- /**
- * Get histories
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getHistories()
- {
- return $this->histories;
- }
- /**
- * Set paper
- *
- * @param SciForum\Version2Bundle\Entity\Paper $paper
- */
- public function setPaper(\SciForum\Version2Bundle\Entity\Paper $paper)
- {
- $this->paper = $paper;
- }
- /**
- * Get paper
- *
- * @return SciForum\Version2Bundle\Entity\Paper
- */
- public function getPaper()
- {
- return $this->paper;
- }
- /**
- * Get authors
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getAuthors()
- {
- return $this->authors;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement