184 lines
3.6 KiB
PHP
184 lines
3.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
* doughnutwedding.com
|
|
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
namespace Sikofitt\DoughnutWeddingBundle\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
/**
|
|
* Class Rsvp.
|
|
*
|
|
* @ORM\Table(name="rsvps")
|
|
* @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\RsvpRepository")
|
|
*/
|
|
class Rsvp
|
|
{
|
|
/**
|
|
* @var int $id
|
|
* @ORM\Id()
|
|
* @ORM\Column(name="id", type="integer", unique=true, nullable=false)
|
|
* @ORM\GeneratedValue(strategy="IDENTITY")
|
|
* @Assert\NotBlank()
|
|
* @Assert\Regex(pattern="'/\d+/'")
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @var \Sikofitt\DoughnutWeddingBundle\Entity\User
|
|
* @ORM\OneToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\User", mappedBy="rsvp", cascade={"persist"})
|
|
*/
|
|
private $user;
|
|
|
|
/**
|
|
* @var int
|
|
* @ORM\Column(name="guests", nullable=true, type="integer")
|
|
* @Assert\Regex(pattern="'/\d+/'")
|
|
* @Assert\Range(min="1", max="2")
|
|
*/
|
|
private $guests;
|
|
|
|
/**
|
|
* @var \DateTime
|
|
* @ORM\Column(name="created", type="datetime")
|
|
*/
|
|
private $created;
|
|
|
|
/**
|
|
* @var \DateTime
|
|
* @ORM\Column(name="updated", type="datetime")
|
|
*/
|
|
private $updated;
|
|
|
|
public function __construct()
|
|
{
|
|
if (null === $this->created) {
|
|
$this->created = new \DateTime('now');
|
|
}
|
|
$this->updated = new \DateTime('now');
|
|
}
|
|
|
|
/**
|
|
* Get id.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getId()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* Set guests.
|
|
*
|
|
* @param int $guests
|
|
*
|
|
* @return Rsvp
|
|
*/
|
|
public function setGuests($guests)
|
|
{
|
|
$this->guests = $guests;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get guests.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getGuests()
|
|
{
|
|
return $this->guests;
|
|
}
|
|
|
|
/**
|
|
* Set created.
|
|
*
|
|
* @param \DateTime $created
|
|
*
|
|
* @return Rsvp
|
|
*/
|
|
public function setCreated($created)
|
|
{
|
|
$this->created = $created;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get created.
|
|
*
|
|
* @return \DateTime
|
|
*/
|
|
public function getCreated()
|
|
{
|
|
return $this->created;
|
|
}
|
|
|
|
/**
|
|
* Set updated.
|
|
*
|
|
* @param \DateTime $updated
|
|
*
|
|
* @return Rsvp
|
|
*/
|
|
public function setUpdated($updated)
|
|
{
|
|
$this->updated = $updated;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get updated.
|
|
*
|
|
* @return \DateTime
|
|
*/
|
|
public function getUpdated()
|
|
{
|
|
return $this->updated;
|
|
}
|
|
|
|
/**
|
|
* Set user.
|
|
*
|
|
* @param User $user
|
|
*
|
|
* @return Rsvp
|
|
*/
|
|
public function setUser(User $user = null)
|
|
{
|
|
$this->user = $user;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get user.
|
|
*
|
|
* @return User
|
|
*/
|
|
public function getUser()
|
|
{
|
|
return $this->user;
|
|
}
|
|
}
|