Created
February 9, 2015 15:53
-
-
Save jesusOmar/94c179a19fce4d7bacb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace AppBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Gedmo\Mapping\Annotation as Gedmo; | |
/** | |
* Appointment | |
* | |
* @ORM\Table(name="appointments") | |
* @ORM\Entity(repositoryClass="AppBundle\Entity\AppointmentRepository") | |
*/ | |
class Appointment | |
{ | |
/** | |
* @var integer | |
* | |
* @ORM\Column(name="id", type="integer") | |
* @ORM\Id | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
private $id; | |
/** | |
* @var \EIP\ProgramBundle\Entity\Activity | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\ProgramBundle\Entity\Activity") | |
* @ORM\JoinColumn(name="activityId", referencedColumnName="id") | |
*/ | |
private $activity; | |
/** | |
* @var \DateTime | |
* | |
* @ORM\Column(name="date", type="datetime") | |
*/ | |
private $date; | |
/** | |
* @var \EIP\AuthenticationBundle\Entity\Location | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\AuthenticationBundle\Entity\Location") | |
* @ORM\JoinColumn(name="locationId", referencedColumnName="id") | |
*/ | |
private $location; | |
/** | |
* @var \EIP\AuthenticationBundle\Entity\User | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\AuthenticationBundle\Entity\User") | |
* @ORM\JoinColumn(name="providerId", referencedColumnName="id") | |
*/ | |
private $provider; | |
/** | |
* @var \AppBundle\Entity\Activity\BaseUserActivity | |
* | |
* @ORM\OneToMany(targetEntity="\AppBundle\Entity\Activity\BaseUserActivity", mappedBy="appointment", cascade={"remove"}) | |
*/ | |
private $registrations; | |
/** | |
* @var \DateTime | |
* | |
* @ORM\Column(name="created", type="datetime") | |
* @Gedmo\Timestampable(on="create") | |
*/ | |
protected $created; | |
/** | |
* @var integer | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\AuthenticationBundle\Entity\User") | |
* @ORM\JoinColumn(name="createdBy", referencedColumnName="id") | |
* @Gedmo\Blameable(on="create") | |
*/ | |
protected $createdBy; | |
/** | |
* @var \DateTime | |
* | |
* @ORM\Column(name="updated", type="datetime") | |
* @Gedmo\Timestampable(on="create") | |
*/ | |
protected $updated; | |
/** | |
* @var integer | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\AuthenticationBundle\Entity\User") | |
* @ORM\JoinColumn(name="updatedBy", referencedColumnName="id") | |
* @Gedmo\Blameable(on="update") | |
*/ | |
protected $updatedBy; | |
/** | |
* Get id | |
* | |
* @return integer | |
*/ | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* Set activity | |
* | |
* @param \EIP\ProgramBundle\Entity\Activity $activity | |
* @return Appointment | |
*/ | |
public function setActivity($activity) | |
{ | |
$this->activity = $activity; | |
return $this; | |
} | |
/** | |
* Get activity | |
* | |
* @return \EIP\ProgramBundle\Entity\Activity | |
*/ | |
public function getActivity() | |
{ | |
return $this->activity; | |
} | |
/** | |
* Set date | |
* | |
* @param \DateTime $date | |
* @return Appointment | |
*/ | |
public function setDate($date) | |
{ | |
$this->date = $date; | |
return $this; | |
} | |
/** | |
* Get date | |
* | |
* @return \DateTime | |
*/ | |
public function getDate() | |
{ | |
return $this->date; | |
} | |
/** | |
* Set location | |
* | |
* @param \EIP\AuthenticationBundle\Entity\Location $location | |
* @return Appointment | |
*/ | |
public function setLocation($location) | |
{ | |
$this->location = $location; | |
return $this; | |
} | |
/** | |
* Get location | |
* | |
* @return \EIP\AuthenticationBundle\Entity\Location | |
*/ | |
public function getLocation() | |
{ | |
return $this->location; | |
} | |
/** | |
* Set provider | |
* | |
* @param \EIP\AuthenticationBundle\Entity\User $provider | |
* @return Appointment | |
*/ | |
public function setProvider($provider) | |
{ | |
$this->provider = $provider; | |
return $this; | |
} | |
/** | |
* Get provider | |
* | |
* @return \EIP\AuthenticationBundle\Entity\User | |
*/ | |
public function getProvider() | |
{ | |
return $this->provider; | |
} | |
/** | |
* Get createdOn | |
* | |
* @return \DateTime | |
*/ | |
public function getCreated() | |
{ | |
return $this->created; | |
} | |
/** | |
* Get createdBy | |
* | |
* @return integer | |
*/ | |
public function getCreatedBy() | |
{ | |
return $this->createdBy; | |
} | |
/** | |
* Get updatedOn | |
* | |
* @return \DateTime | |
*/ | |
public function getUpdated() | |
{ | |
return $this->updated; | |
} | |
/** | |
* Get updatedBy | |
* | |
* @return integer | |
*/ | |
public function getUpdatedBy() | |
{ | |
return $this->updatedBy; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace AppBundle\Entity\Activity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\ORM\Mapping as ORM; | |
use EIP\AuthenticationBundle\Entity\User; | |
use EIP\ProgramBundle\Entity\Activity; | |
use EIP\ProgramBundle\Entity\Status; | |
use Stanford\QuestionsBundle\Entity\Answer; | |
use Stanford\SettingsBundle\Settings\DateTime; | |
use Symfony\Component\Validator\Constraints as Assert; | |
/** | |
* BaseUserActivity | |
* | |
* @ORM\Table(name="user_activity") | |
* @ORM\Entity() | |
* @ORM\Entity(repositoryClass="AppBundle\Entity\Activity\Repository\BaseUserActivityRepository") | |
* @ORM\InheritanceType("SINGLE_TABLE") | |
* @ORM\DiscriminatorColumn(name="type", type="string") | |
* @ORM\DiscriminatorMap({ | |
* "user_activity" = "\EIP\ProgramBundle\Entity\UserActivity", | |
* "plan" = "\AppBundle\Entity\Activity\Plan", | |
* "reflection" = "\AppBundle\Entity\Activity\Reflection", | |
* "take_action" = "\AppBundle\Entity\Activity\TakeAction", | |
* "coaching" = "\AppBundle\Entity\Activity\Coaching" | |
* }) | |
*/ | |
abstract class BaseUserActivity | |
{ | |
/** | |
* @var integer | |
* | |
* @ORM\Column(name="id", type="integer") | |
* @ORM\Id | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
protected $id; | |
/** | |
* @var array $user | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\AuthenticationBundle\Entity\User", inversedBy="userActivities") | |
* @ORM\JoinColumn(name="userId", referencedColumnName="id", onDelete="CASCADE") | |
*/ | |
protected $user; | |
/** | |
* @var array $activity | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\ProgramBundle\Entity\Activity", inversedBy="userActivities") | |
* @ORM\JoinColumn(name="activityId", referencedColumnName="id") | |
* @Assert\NotBlank(message="The user activity needs to be associated with an activity.") | |
*/ | |
protected $activity; | |
/** | |
* @var datetime $startedOn | |
* | |
* @ORM\Column(type="datetime") | |
*/ | |
protected $startedOn; | |
/** | |
* @var datetime $completedOn | |
* | |
* @ORM\Column(type="datetime", nullable=true) | |
*/ | |
protected $completedOn; | |
/** | |
* @var Status $status | |
* | |
* @ORM\ManyToOne(targetEntity="\EIP\ProgramBundle\Entity\Status") | |
* @ORM\JoinColumn(name="statusId", referencedColumnName="id") | |
*/ | |
protected $status; | |
/** | |
* @var ArrayCollection $answers | |
* | |
* @ORM\OneToMany(targetEntity="\Stanford\QuestionsBundle\Entity\Answer", mappedBy="userActivity", cascade={"persist", "remove"}) | |
*/ | |
protected $answers; | |
/** | |
* @var \AppBundle\Entity\Appointment | |
* | |
* @ORM\ManyToOne(targetEntity="\AppBundle\Entity\Appointment", inversedBy="registrations") | |
* @ORM\JoinColumn(name="appointmentId", referencedColumnName="id") | |
*/ | |
protected $appointment; | |
/** | |
* @var boolean $valid | |
* | |
* @ORM\Column(type="boolean") | |
*/ | |
private $valid; | |
public function __construct() { | |
$this->answers = new ArrayCollection(); | |
$this->valid = false; | |
$this->setStartedOn(); | |
} | |
/** | |
* Get id | |
* | |
* @return integer | |
*/ | |
public function getId() { | |
return $this->id; | |
} | |
/** | |
* Get startedOn | |
* | |
* @return datetime | |
*/ | |
public function getStartedOn() | |
{ | |
return $this->startedOn; | |
} | |
/** | |
* Set startedOn | |
* | |
*/ | |
public function setStartedOn($startedOn = null) | |
{ | |
if ($startedOn) { | |
$this->startedOn = $startedOn; | |
} else { | |
$this->startedOn = new DateTime(); | |
} | |
} | |
/** | |
* Get completedOn | |
* | |
* @return datetime | |
*/ | |
public function getCompletedOn() | |
{ | |
return $this->completedOn; | |
} | |
/** | |
* Set completedOn | |
* | |
* @param string $completedOn | |
*/ | |
public function setCompletedOn($completedOn = null) | |
{ | |
if ($completedOn) { | |
$this->completedOn = $completedOn; | |
} else { | |
$this->completedOn = new DateTime(); | |
} | |
} | |
/** | |
* Get status | |
* | |
* @return Status | |
*/ | |
public function getStatus() | |
{ | |
return $this->status; | |
} | |
/** | |
* Set status | |
* | |
* @param Status $status | |
*/ | |
public function setStatus(Status $status) | |
{ | |
$this->status = $status; | |
} | |
/** | |
* Get user | |
* | |
* @return User | |
*/ | |
public function getUser() | |
{ | |
return $this->user; | |
} | |
/** | |
* Set user | |
* | |
* @param User $user | |
*/ | |
public function setUser(User $user) | |
{ | |
$this->user = $user; | |
} | |
/** | |
* Get activity | |
* | |
* @return Activity | |
*/ | |
public function getActivity() | |
{ | |
return $this->activity; | |
} | |
/** | |
* Set activity | |
* | |
* @param Activity $activity | |
*/ | |
public function setActivity(Activity $activity) | |
{ | |
$this->activity = $activity; | |
} | |
/** | |
* @param Answer $answer | |
* @return bool | |
*/ | |
protected function hasAnswer(Answer $answer) | |
{ | |
return $this->answers->contains($answer); | |
} | |
/** | |
* @return boolean | |
*/ | |
public function isValid() | |
{ | |
return $this->valid; | |
} | |
/** | |
* @param boolean $valid | |
*/ | |
public function setValid($valid) | |
{ | |
$this->valid = $valid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment