Refactored code to comply with PSR-*
Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
This commit is contained in:
@@ -12,247 +12,273 @@ use KekRozsak\SecurityBundle\Entity\User;
|
||||
*/
|
||||
class Article
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the Article
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
/**
|
||||
* The User who created the Article
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
/**
|
||||
* The timestamp when the Article was created
|
||||
*
|
||||
* @var DateTime $createdAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $title;
|
||||
/**
|
||||
* The title of the Article
|
||||
*
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Article
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Article
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $slug;
|
||||
/**
|
||||
* The slugified title of the Article
|
||||
*
|
||||
* @var string $slug
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Article
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Article
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $text;
|
||||
/**
|
||||
* The content of the Article
|
||||
*
|
||||
* @var string $text
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $text;
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @return Article
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @return Article
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $mainPage
|
||||
* @ORM\Column(type="boolean", name="main_page")
|
||||
*/
|
||||
protected $mainPage;
|
||||
/**
|
||||
* TRUE if the article should display on the main mage
|
||||
*
|
||||
* @var boolean $mainPage
|
||||
*
|
||||
* @ORM\Column(type="boolean", name="main_page")
|
||||
*/
|
||||
protected $mainPage;
|
||||
|
||||
/**
|
||||
* Set mainPage
|
||||
*
|
||||
* @param boolean $mainPage
|
||||
* @return Article
|
||||
*/
|
||||
public function setMainPage($mainPage)
|
||||
{
|
||||
$this->mainPage = $mainPage;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set mainPage
|
||||
*
|
||||
* @param boolean $mainPage
|
||||
* @return Article
|
||||
*/
|
||||
public function setMainPage($mainPage)
|
||||
{
|
||||
$this->mainPage = $mainPage;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mainPage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getMainPage()
|
||||
{
|
||||
return $this->mainPage;
|
||||
}
|
||||
/**
|
||||
* Get mainPage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getMainPage()
|
||||
{
|
||||
return $this->mainPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean public
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $public;
|
||||
/**
|
||||
* TRUE if the article is viewable by anyone
|
||||
*
|
||||
* @var boolean public
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $public;
|
||||
|
||||
/**
|
||||
* Set public
|
||||
*
|
||||
* @param boolean $public
|
||||
* @return Article
|
||||
*/
|
||||
public function setPublic($public = false)
|
||||
{
|
||||
$this->public = $public;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set public
|
||||
*
|
||||
* @param boolean $public
|
||||
* @return Article
|
||||
*/
|
||||
public function setPublic($public = false)
|
||||
{
|
||||
$this->public = $public;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get public
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPublic()
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
/**
|
||||
* Get public
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPublic()
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $source
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $source;
|
||||
/**
|
||||
* The source of the Article, if any
|
||||
*
|
||||
* @var string $source
|
||||
*
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* Set source
|
||||
*
|
||||
* @param string $source
|
||||
* @return Article
|
||||
*/
|
||||
public function setSource($source = null)
|
||||
{
|
||||
$this->source = $source;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set source
|
||||
*
|
||||
* @param string $source
|
||||
* @return Article
|
||||
*/
|
||||
public function setSource($source = null)
|
||||
{
|
||||
$this->source = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
/**
|
||||
* Get source
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,282 +18,348 @@ use KekRozsak\SecurityBundle\Entity\User;
|
||||
*/
|
||||
class Book
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->copies = new ArrayCollection();
|
||||
$this->wouldBorrow = new ArrayCollection();
|
||||
$this->wouldBuy = new ArrayCollection();
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->copies = new ArrayCollection();
|
||||
$this->wouldBorrow = new ArrayCollection();
|
||||
$this->wouldBuy = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the Book
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $copies
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="BookCopy", mappedBy="book")
|
||||
*/
|
||||
protected $copies;
|
||||
/**
|
||||
* The copies available for this Book
|
||||
*
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $copies
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="BookCopy", mappedBy="book")
|
||||
*/
|
||||
protected $copies;
|
||||
|
||||
/**
|
||||
* Remove a copy
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\BookCopy $copy
|
||||
* @return Book
|
||||
*/
|
||||
public function removeCopy(BookCopy $copy)
|
||||
{
|
||||
$this->copies->removeElement($copy);
|
||||
}
|
||||
/**
|
||||
* Remove a copy
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\BookCopy $copy
|
||||
* @return Book
|
||||
*/
|
||||
public function removeCopy(BookCopy $copy)
|
||||
{
|
||||
$this->copies->removeElement($copy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get copies
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopies()
|
||||
{
|
||||
return $this->copies;
|
||||
}
|
||||
/**
|
||||
* Get copies
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopies()
|
||||
{
|
||||
return $this->copies;
|
||||
}
|
||||
|
||||
public function getCopiesBorrowed()
|
||||
{
|
||||
return $this->copies->filter(function($copy) {
|
||||
return ($copy->getBorrower() !== null);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get the copies of this Book those are borrowed by someone
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopiesBorrowed()
|
||||
{
|
||||
return $this->copies->filter(function($copy)
|
||||
{
|
||||
return ($copy->getBorrower() !== null);
|
||||
});
|
||||
}
|
||||
|
||||
public function getCopiesBorrowedByUser(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return ($copy->getBorrower() == $user);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get the copies of this Book those are borrowed by $user
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopiesBorrowedByUser(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return ($copy->getBorrower() == $user);
|
||||
});
|
||||
}
|
||||
|
||||
public function getCopiesBorrowedReturnedByUser(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return ($copy->getBorrower() == $user) && ($copy->isBorrowerReturned());
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get the copies of this Book those are borrowed by $user, but marked as
|
||||
* returned
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopiesBorrowedReturnedByUser(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return ($copy->getBorrower() == $user) && ($copy->isBorrowerReturned());
|
||||
});
|
||||
}
|
||||
|
||||
public function getCopiesBorrowable()
|
||||
{
|
||||
return $this->copies->filter(function($copy) {
|
||||
return $copy->isBorrowable();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get all the borrowable copies of this Book
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getCopiesBorrowable()
|
||||
{
|
||||
return $this->copies->filter(function($copy) {
|
||||
return $copy->isBorrowable();
|
||||
});
|
||||
}
|
||||
|
||||
public function getUsersCopies(User $user)
|
||||
{
|
||||
return $this->copies->filter(function ($copy) use ($user) {
|
||||
return ($copy->getOwner() == $user);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get $user's copies of this Book
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getUsersCopies(User $user)
|
||||
{
|
||||
return $this->copies->filter(function ($copy) use ($user)
|
||||
{
|
||||
return ($copy->getOwner() == $user);
|
||||
});
|
||||
}
|
||||
|
||||
public function getUsersCopiesBorrowable(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return (($copy->getOwner() == $user) && $copy->isBorrowable());
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get $user's borrowable copies of this Book
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getUsersCopiesBorrowable(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return (($copy->getOwner() == $user) && $copy->isBorrowable());
|
||||
});
|
||||
}
|
||||
|
||||
public function getUsersCopiesBuyable(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user) {
|
||||
return (($copy->getOwner() == $user) && $copy->isBuyable());
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get $user's buyable copies of this Book
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getUsersCopiesBuyable(User $user)
|
||||
{
|
||||
return $this->copies->filter(function($copy) use ($user)
|
||||
{
|
||||
return (($copy->getOwner() == $user) && $copy->isBuyable());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $author
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $author;
|
||||
/**
|
||||
* The author of the Book
|
||||
*
|
||||
* @var string $author
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $author;
|
||||
|
||||
/**
|
||||
* Set author
|
||||
*
|
||||
* @param string $author
|
||||
* @return Book
|
||||
*/
|
||||
public function setAuthor($author)
|
||||
{
|
||||
$this->author = $author;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set author
|
||||
*
|
||||
* @param string $author
|
||||
* @return Book
|
||||
*/
|
||||
public function setAuthor($author)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->author = $author;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get author
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthor()
|
||||
{
|
||||
return $this->author;
|
||||
}
|
||||
/**
|
||||
* Get author
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthor()
|
||||
{
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $title;
|
||||
/**
|
||||
* The title of the Book
|
||||
*
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Book
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Book
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $year
|
||||
*
|
||||
* @ORM\Column(type="integer", nullable=false)
|
||||
*/
|
||||
protected $year;
|
||||
/**
|
||||
* The Book's year of publication
|
||||
*
|
||||
* @var integer $year
|
||||
*
|
||||
* @ORM\Column(type="integer", nullable=false)
|
||||
*/
|
||||
protected $year;
|
||||
|
||||
/**
|
||||
* Set year
|
||||
*
|
||||
* @param integer $year
|
||||
* @return Book
|
||||
*/
|
||||
public function setYear($year)
|
||||
{
|
||||
$this->year = $year;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set year
|
||||
*
|
||||
* @param integer $year
|
||||
* @return Book
|
||||
*/
|
||||
public function setYear($year)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->year = $year;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get year
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getYear()
|
||||
{
|
||||
return $this->year;
|
||||
}
|
||||
/**
|
||||
* Get year
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getYear()
|
||||
{
|
||||
return $this->year;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $commentable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $commentable;
|
||||
/**
|
||||
* TRUE if comments can be written about the Book
|
||||
* @var boolean $commentable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $commentable;
|
||||
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $wouldBorrow
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinTable(name="book_would_borrow")
|
||||
*/
|
||||
protected $wouldBorrow;
|
||||
/**
|
||||
* Collection of Users who would like to borrow a copy
|
||||
*
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $wouldBorrow
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinTable(name="book_would_borrow")
|
||||
*/
|
||||
protected $wouldBorrow;
|
||||
|
||||
/**
|
||||
* Add a user for want-to-borrowers
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Book
|
||||
*/
|
||||
public function addWouldBorrow(User $user)
|
||||
{
|
||||
$this->wouldBorrow->add($user);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add a user for want-to-borrowers
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Book
|
||||
*/
|
||||
public function addWouldBorrow(User $user)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->wouldBorrow->add($user);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wouldBorrow list
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getWouldBorrow()
|
||||
{
|
||||
return $this->wouldBorrow;
|
||||
}
|
||||
/**
|
||||
* Get wouldBorrow list
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getWouldBorrow()
|
||||
{
|
||||
return $this->wouldBorrow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if specified user would borrow this book
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function userWouldBorrow(User $user)
|
||||
{
|
||||
return $this->wouldBorrow->contains($user);
|
||||
}
|
||||
/**
|
||||
* Check if $user would like to borrow this book
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function userWouldBorrow(User $user)
|
||||
{
|
||||
return $this->wouldBorrow->contains($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $wouldBuy
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinTable(name="book_would_buy")
|
||||
*/
|
||||
protected $wouldBuy;
|
||||
/**
|
||||
* Collection of Users who would like to buy a copy of this book
|
||||
*
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $wouldBuy
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinTable(name="book_would_buy")
|
||||
*/
|
||||
protected $wouldBuy;
|
||||
|
||||
/**
|
||||
* Add a user for want-to-buyers
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Book
|
||||
*/
|
||||
public function addWouldBuy(User $user)
|
||||
{
|
||||
$this->wouldBuy->add($user);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add a user for want-to-buyers
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return Book
|
||||
*/
|
||||
public function addWouldBuy(User $user)
|
||||
{
|
||||
$this->wouldBuy->add($user);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wouldBuy list
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getWouldBuy()
|
||||
{
|
||||
return $this->wouldBuy;
|
||||
}
|
||||
/**
|
||||
* Get wouldBuy list
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getWouldBuy()
|
||||
{
|
||||
return $this->wouldBuy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if specified user would buy this book
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function userWouldBuy(User $user)
|
||||
{
|
||||
return $this->wouldBuy->contains($user);
|
||||
}
|
||||
/**
|
||||
* Check if specified user would buy this book
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function userWouldBuy(User $user)
|
||||
{
|
||||
return $this->wouldBuy->contains($user);
|
||||
}
|
||||
}
|
||||
|
@@ -19,147 +19,163 @@ use KekRozsak\SecurityBundle\Entity\User;
|
||||
*/
|
||||
class BookCopy
|
||||
{
|
||||
public function __construct(Book $book, User $owner)
|
||||
{
|
||||
$this->book = $book;
|
||||
$this->owner = $owner;
|
||||
$this->borrowable = false;
|
||||
$this->buyable = false;
|
||||
$this->borrower = null;
|
||||
$this->borrowerReturned = true;
|
||||
}
|
||||
public function __construct(Book $book, User $owner)
|
||||
{
|
||||
$this->book = $book;
|
||||
$this->owner = $owner;
|
||||
$this->borrowable = false;
|
||||
$this->buyable = false;
|
||||
$this->borrower = null;
|
||||
$this->borrowerReturned = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the BookCopy
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @var KekRozsak\FrontBundle\Entity\Book $book
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Book", inversedBy="copies")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $book;
|
||||
/**
|
||||
* The Book this BookCopy belongs to
|
||||
* @var KekRozsak\FrontBundle\Entity\Book $book
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Book", inversedBy="copies")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $book;
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $owner
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $owner;
|
||||
/**
|
||||
* The User this BookCopy belongs to
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $owner
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $owner;
|
||||
|
||||
/**
|
||||
* Get owner
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getOwner()
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
/**
|
||||
* Get owner
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getOwner()
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $ownerComment
|
||||
*
|
||||
* @ORM\Column(type="text", name="owner_comment", nullable=true)
|
||||
*/
|
||||
protected $ownerComment;
|
||||
/**
|
||||
* The owner's comment about this BookCopy's Book
|
||||
*
|
||||
* @var string $ownerComment
|
||||
*
|
||||
* @ORM\Column(type="text", name="owner_comment", nullable=true)
|
||||
*/
|
||||
protected $ownerComment;
|
||||
|
||||
/**
|
||||
* @var boolean $borrowable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $borrowable;
|
||||
/**
|
||||
* TRUE if this BookCopy is borrowable
|
||||
*
|
||||
* @var boolean $borrowable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $borrowable;
|
||||
|
||||
/**
|
||||
* Set borrowable
|
||||
*
|
||||
* @param boolean $borrowable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBorrowable($borrowable)
|
||||
{
|
||||
$this->borrowable = $borrowable;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set borrowable
|
||||
*
|
||||
* @param boolean $borrowable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBorrowable($borrowable)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->borrowable = $borrowable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get borrowable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBorrowable()
|
||||
{
|
||||
return $this->borrowable;
|
||||
}
|
||||
/**
|
||||
* Get borrowable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBorrowable()
|
||||
{
|
||||
return $this->borrowable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $buyable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $buyable;
|
||||
/**
|
||||
* TRUE if this BookCopy is for sale
|
||||
*
|
||||
* @var boolean $buyable
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $buyable;
|
||||
|
||||
/**
|
||||
* Set buyable
|
||||
*
|
||||
* @param boolean $buyable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBuyable($buyable)
|
||||
{
|
||||
$this->buyable = $buyable;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set buyable
|
||||
*
|
||||
* @param boolean $buyable
|
||||
* @return BookCopy
|
||||
*/
|
||||
public function setBuyable($buyable)
|
||||
{
|
||||
// Check if parameter is boolean!
|
||||
$this->buyable = $buyable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get borrowable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBuyable()
|
||||
{
|
||||
return $this->buyable;
|
||||
}
|
||||
/**
|
||||
* Get buyable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBuyable()
|
||||
{
|
||||
return $this->buyable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $borrower
|
||||
*
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
*/
|
||||
protected $borrower;
|
||||
/**
|
||||
* The User who is currently borrowing this BookCopy, or null
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $borrower
|
||||
*
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
*/
|
||||
protected $borrower;
|
||||
|
||||
/**
|
||||
* Get borrower
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getBorrower()
|
||||
{
|
||||
return $this->borrower;
|
||||
}
|
||||
/**
|
||||
* Get borrower
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getBorrower()
|
||||
{
|
||||
return $this->borrower;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $borrowerReturned
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false, name="borrower_returned")
|
||||
*/
|
||||
protected $borrowerReturned;
|
||||
/**
|
||||
* TRUE if borrower says he/she returned this Copy to the owner
|
||||
* @var boolean $borrowerReturned
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false, name="borrower_returned")
|
||||
*/
|
||||
protected $borrowerReturned;
|
||||
|
||||
/**
|
||||
* Get borrowerReturned
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBorrowerReturned()
|
||||
{
|
||||
return $this->borrowerReturned();
|
||||
}
|
||||
/**
|
||||
* Get borrowerReturned
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBorrowerReturned()
|
||||
{
|
||||
return $this->borrowerReturned();
|
||||
}
|
||||
}
|
||||
|
@@ -19,282 +19,305 @@ use KekRozsak\FrontBundle\Entity\Group;
|
||||
*/
|
||||
class Document
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->groups = new ArrayCollection();
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->groups = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the Document
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $title;
|
||||
/**
|
||||
* The title of the Document
|
||||
*
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Document
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Document
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $slug;
|
||||
/**
|
||||
* The slugified title of this Document
|
||||
*
|
||||
* @var string $slug
|
||||
*
|
||||
* @ORM\Column(type="string", length=150, unique=true, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Document
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Document
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
/**
|
||||
* The User who created this Document
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Document
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Document
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
/**
|
||||
* The timestamp when the Document was created
|
||||
*
|
||||
* @var DateTime $createdat
|
||||
*
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* @var DateTime $createdat
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
protected $createdAt;
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Document
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Document
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
/**
|
||||
* The content of the Document
|
||||
*
|
||||
* @var string $content
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $content;
|
||||
|
||||
/**
|
||||
* @var string $content
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $content;
|
||||
/**
|
||||
* Set content
|
||||
*
|
||||
* @param string $content
|
||||
* @return Document
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content
|
||||
*
|
||||
* @param string $content
|
||||
* @return Document
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $groups
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", mappedBy="documents")
|
||||
*/
|
||||
protected $groups;
|
||||
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $groups
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", mappedBy="documents")
|
||||
*/
|
||||
protected $groups;
|
||||
/**
|
||||
* Add a group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return Document
|
||||
*/
|
||||
public function addGroup(Group $group)
|
||||
{
|
||||
$this->groups[] = $group;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return Document
|
||||
*/
|
||||
public function addGroup(\KekRozsak\FrontBundle\Entity\Group $group)
|
||||
{
|
||||
$this->groups[] = $group;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get all groups
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all groups
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
/**
|
||||
* The User who last updated the Document
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $updatedBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
*/
|
||||
protected $updatedBy;
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $updatedBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
*/
|
||||
protected $updatedBy;
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $updatedBy
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $updatedBy
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdatedBy(\KekRozsak\SecurityBundle\Entity\User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
/**
|
||||
* The timestamp the Document was last updated
|
||||
*
|
||||
* @var DateTime $updatedAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
protected $updatedAt;
|
||||
|
||||
/**
|
||||
* @var DateTime $updatedAt
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
protected $updatedAt;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string updateReason
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
protected $updateReason;
|
||||
/**
|
||||
* @var string updateReason
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
protected $updateReason;
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param string $updateReason
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdateReason($updateReason = null)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param string $updateReason
|
||||
* @return Document
|
||||
*/
|
||||
public function setUpdateReason($updateReason = null)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,9 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
|
||||
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Entity\Group;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="events")
|
||||
@@ -16,403 +19,432 @@ use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
|
||||
*/
|
||||
class Event
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the Event
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
/**
|
||||
* The User who created the Event
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Event
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Event
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $startDate
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true, name="start_date", nullable=false)
|
||||
*/
|
||||
protected $startDate;
|
||||
/**
|
||||
* The date on which the Event starts
|
||||
*
|
||||
* @var DateTime $startDate
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true, name="start_date", nullable=false)
|
||||
*/
|
||||
protected $startDate;
|
||||
|
||||
/**
|
||||
* Set startDate
|
||||
*
|
||||
* @param DateTime $startDate
|
||||
* @return Event
|
||||
*/
|
||||
public function setStartDate(\DateTime $startDate = null)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set startDate
|
||||
*
|
||||
* @param DateTime $startDate
|
||||
* @return Event
|
||||
*/
|
||||
public function setStartDate(\DateTime $startDate = null)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get startDate
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
/**
|
||||
* Get startDate
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $endDate
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true, name="end_date")
|
||||
*/
|
||||
protected $endDate;
|
||||
/**
|
||||
* The date on which the Event ends. May be null if same as $startDate
|
||||
*
|
||||
* @var DateTime $endDate
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true, name="end_date")
|
||||
*/
|
||||
protected $endDate;
|
||||
|
||||
/**
|
||||
* Set endDate
|
||||
*
|
||||
* @param DateTime $endDate
|
||||
* @return Event
|
||||
*/
|
||||
public function setEndDate(\DateTime $endDate)
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set endDate
|
||||
*
|
||||
* @param DateTime $endDate
|
||||
* @return Event
|
||||
*/
|
||||
public function setEndDate(\DateTime $endDate = null)
|
||||
{
|
||||
// TODO: Check if endDate is later than startDate
|
||||
$this->endDate = $endDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get endDate
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getEndDate()
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
/**
|
||||
* Get endDate
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getEndDate()
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $attendees
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinTable(name="event_attendees")
|
||||
*/
|
||||
protected $attendees;
|
||||
/**
|
||||
* An ArrayCollection of Users who wish to attend on this Event
|
||||
*
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $attendees
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinTable(name="event_attendees")
|
||||
*/
|
||||
protected $attendees;
|
||||
|
||||
/**
|
||||
* Add attendee
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $attendee
|
||||
* @return Event
|
||||
*/
|
||||
public function addAttendee(\KekRozsak\SecurityBundle\Entity\User $attendee)
|
||||
{
|
||||
$this->attendees[] = $attendee;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add attendee
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $attendee
|
||||
* @return Event
|
||||
*/
|
||||
public function addAttendee(User $attendee)
|
||||
{
|
||||
$this->attendees[] = $attendee;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all attendees
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getAttendees()
|
||||
{
|
||||
return $this->attendees;
|
||||
}
|
||||
/**
|
||||
* Get all attendees
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getAttendees()
|
||||
{
|
||||
return $this->attendees;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a user is attending
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAttending(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
$users = $this->attendees->filter(function ($attendee) use ($user) {
|
||||
if ($attendee == $user)
|
||||
return true;
|
||||
});
|
||||
|
||||
return ($users->count() != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=150)
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Event
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
*
|
||||
* @ORM\Column(type="string", length=150)
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Event
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $description
|
||||
*
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
* @return Event
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\FrontBundle\Entity\Group $group
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\FrontBundle\Entity\Group")
|
||||
*/
|
||||
protected $group;
|
||||
|
||||
/**
|
||||
* Set group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return Event
|
||||
*/
|
||||
public function setGroup(\KekRozsak\FrontBundle\Entity\Group $group = null)
|
||||
{
|
||||
$this->group = $group;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group
|
||||
*
|
||||
* @return KekRozsak\FrontBundle\Entity\Group
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $cancelled
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $cancelled;
|
||||
|
||||
/**
|
||||
* Set cancelled
|
||||
*
|
||||
* @param boolean $cancelled
|
||||
* @return Event
|
||||
*/
|
||||
public function setCancelled($cancelled = false)
|
||||
{
|
||||
$this->cancelled = $cancelled;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cancelled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCancelled()
|
||||
{
|
||||
return $this->cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $startTime
|
||||
*
|
||||
* @ORM\Column(type="time", nullable=false, name="start_time")
|
||||
*/
|
||||
protected $startTime;
|
||||
|
||||
/**
|
||||
* Set startTime
|
||||
*
|
||||
* @param DateTime $startTime
|
||||
* @return Event
|
||||
*/
|
||||
public function setStartTime(\DateTime $startTime)
|
||||
{
|
||||
$this->startTime = $startTime;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get startTime
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getStartTime()
|
||||
{
|
||||
return $this->startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $endTime
|
||||
*
|
||||
* @ORM\Column(type="time", nullable=true, name="end_time")
|
||||
*/
|
||||
protected $endTime;
|
||||
|
||||
/**
|
||||
* Set endTime
|
||||
*
|
||||
* @param DateTime $endTime
|
||||
* @return Event
|
||||
*/
|
||||
public function setEndTime(\DateTime $endTime)
|
||||
{
|
||||
$this->endTime = $endTime;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get endTime
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getEndTime()
|
||||
{
|
||||
return $this->endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an event will go on a specific date
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOnDate(\DateTime $date)
|
||||
{
|
||||
$date->setTime(0, 0, 0);
|
||||
|
||||
return (
|
||||
(
|
||||
($this->startDate == $date)
|
||||
&& ($this->endDate === null)
|
||||
)
|
||||
|| (
|
||||
($this->startDate <= $date)
|
||||
&& ($this->endDate >= $date)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the event happened before a given date
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPast(\DateTime $date = null)
|
||||
/**
|
||||
* Check if a user is attending
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAttending(User $user)
|
||||
{
|
||||
$users = $this->attendees->filter(function ($attendee) use ($user)
|
||||
{
|
||||
if ($date === null)
|
||||
{
|
||||
$date = new \DateTime('now');
|
||||
if ($attendee == $user) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return ($this->endDate < $date);
|
||||
return ($users->count() != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the Event
|
||||
*
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=150)
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return Event
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slugified title of the event
|
||||
*
|
||||
* @var string $slug
|
||||
*
|
||||
* @ORM\Column(type="string", length=150)
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Event
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Event
|
||||
*
|
||||
* @var string $description
|
||||
*
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
* @return Event
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\FrontBundle\Entity\Group $group
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\FrontBundle\Entity\Group")
|
||||
*/
|
||||
protected $group;
|
||||
|
||||
/**
|
||||
* Set group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group $group
|
||||
* @return Event
|
||||
*/
|
||||
public function setGroup(Group $group = null)
|
||||
{
|
||||
$this->group = $group;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group
|
||||
*
|
||||
* @return KekRozsak\FrontBundle\Entity\Group
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
|
||||
/**
|
||||
* TRUE if the Event is cancelled
|
||||
*
|
||||
* @var boolean $cancelled
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $cancelled;
|
||||
|
||||
/**
|
||||
* Set cancelled
|
||||
*
|
||||
* @param boolean $cancelled
|
||||
* @return Event
|
||||
*/
|
||||
public function setCancelled($cancelled = false)
|
||||
{
|
||||
// TODO: Check if parameter is boolean
|
||||
$this->cancelled = $cancelled;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cancelled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCancelled()
|
||||
{
|
||||
return $this->cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* The time when the Event starts
|
||||
*
|
||||
* @var DateTime $startTime
|
||||
*
|
||||
* @ORM\Column(type="time", nullable=false, name="start_time")
|
||||
*/
|
||||
protected $startTime;
|
||||
|
||||
/**
|
||||
* Set startTime
|
||||
*
|
||||
* @param DateTime $startTime
|
||||
* @return Event
|
||||
*/
|
||||
public function setStartTime(\DateTime $startTime)
|
||||
{
|
||||
$this->startTime = $startTime;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get startTime
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getStartTime()
|
||||
{
|
||||
return $this->startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* The time when the Event ends
|
||||
*
|
||||
* @var DateTime $endTime
|
||||
*
|
||||
* @ORM\Column(type="time", nullable=true, name="end_time")
|
||||
*/
|
||||
protected $endTime;
|
||||
|
||||
/**
|
||||
* Set endTime
|
||||
*
|
||||
* @param DateTime $endTime
|
||||
* @return Event
|
||||
*/
|
||||
public function setEndTime(\DateTime $endTime = null)
|
||||
{
|
||||
// TODO: Check if endTime is later than startDate + startTime
|
||||
$this->endTime = $endTime;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get endTime
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getEndTime()
|
||||
{
|
||||
return $this->endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an event will go on a specific date
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOnDate(\DateTime $date)
|
||||
{
|
||||
$date->setTime(0, 0, 0);
|
||||
|
||||
return (
|
||||
(
|
||||
($this->startDate == $date)
|
||||
&& ($this->endDate === null)
|
||||
)
|
||||
|| (
|
||||
($this->startDate <= $date)
|
||||
&& ($this->endDate >= $date)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the event happened before a given date
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPast(\DateTime $date = null)
|
||||
{
|
||||
if ($date === null) {
|
||||
$date = new \DateTime('now');
|
||||
}
|
||||
|
||||
return ($this->endDate < $date);
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\ForumTopic;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
@@ -13,146 +14,172 @@ use KekRozsak\FrontBundle\Entity\ForumTopic;
|
||||
*/
|
||||
class ForumPost
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the ForumPost
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $text;
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumTopic $topic
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
|
||||
*/
|
||||
protected $topic;
|
||||
|
||||
/**
|
||||
* Set topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setTopic(ForumTopic $topic)
|
||||
{
|
||||
$this->topic = $topic;
|
||||
if (!$topic->getLastPost() || ($topic->getLastPost()->getCreatedAt() < $this->createdAt))
|
||||
$topic->setLastPost($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topic
|
||||
*
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function getTopic()
|
||||
{
|
||||
return $this->topic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set createdAt before persisting
|
||||
*
|
||||
* @ORM\PrePersist
|
||||
*/
|
||||
public function setCreationTime()
|
||||
{
|
||||
if ($this->createdAt === null)
|
||||
$this->createdAt = new \DateTime('now');
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The User who created this ForumPost
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* The timestamp when the ForumPost was created
|
||||
*
|
||||
* @var DateTime $createdAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdAt = $createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the ForumPost
|
||||
*
|
||||
* @var string $text
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $text;
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ForumTopic in which this ForumPost is
|
||||
*
|
||||
* @var ForumTopic $topic
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
|
||||
*/
|
||||
protected $topic;
|
||||
|
||||
/**
|
||||
* Set topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setTopic(ForumTopic $topic)
|
||||
{
|
||||
// Set this as the last post of $topic, if later than $topic's current
|
||||
// last post
|
||||
$this->topic = $topic;
|
||||
if (
|
||||
!$topic->getLastPost()
|
||||
|| ($topic->getLastPost()->getCreatedAt() < $this->createdAt)
|
||||
) {
|
||||
$topic->setLastPost($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topic
|
||||
*
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function getTopic()
|
||||
{
|
||||
return $this->topic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set createdAt before persisting
|
||||
*
|
||||
* @ORM\PrePersist
|
||||
*/
|
||||
public function setCreationTime()
|
||||
{
|
||||
if ($this->createdAt === null) {
|
||||
$this->createdAt = new \DateTime('now');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,226 +13,254 @@ use KekRozsak\SecurityBundle\Entity\User;
|
||||
*/
|
||||
class ForumTopic
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->posts = new ArrayCollection();
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->posts = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the ForumTopic
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
/**
|
||||
* The User who created this ForumTopic
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* The timestamp when the ForumTopic was created
|
||||
*
|
||||
* @var DateTime $createdAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
protected $createdAt;
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if not null!
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
/**
|
||||
* The ForumTopicGroup to which this ForumTopic belongs
|
||||
*
|
||||
* @var ForumTopicGroup $topicGroup
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics")
|
||||
* @ORM\JoinColumn(name="topic_group_id")
|
||||
*/
|
||||
protected $topicGroup;
|
||||
|
||||
/**
|
||||
* @var ForumTopicGroup $topicGroup
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics")
|
||||
* @ORM\JoinColumn(name="topic_group_id")
|
||||
*/
|
||||
protected $topicGroup;
|
||||
/**
|
||||
* Set topicGroup
|
||||
*
|
||||
* @param ForumTopicGroup $topicGroup
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTopicGroup(ForumTopicGroup $topicGroup)
|
||||
{
|
||||
// TODO: Check if not null!
|
||||
$this->topicGroup = $topicGroup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set topicGroup
|
||||
*
|
||||
* @param ForumTopicGroup $topicGroup
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTopicGroup(ForumTopicGroup $topicGroup)
|
||||
{
|
||||
$this->topicGroup = $topicGroup;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get topicGroup
|
||||
*
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function getTopicGroup()
|
||||
{
|
||||
return $this->topicGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topicGroup
|
||||
*
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function getTopicGroup()
|
||||
{
|
||||
return $this->topicGroup;
|
||||
}
|
||||
/**
|
||||
* The slugified title of the ForumTopic
|
||||
*
|
||||
* @var string $slug
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $slug;
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
/**
|
||||
* The title of the ForumTopic
|
||||
*
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
protected $title;
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
/**
|
||||
* The last Post of this ForumTopic, is any
|
||||
*
|
||||
* @var ForumPost $lastPost
|
||||
*
|
||||
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="last_post_id")
|
||||
*/
|
||||
protected $lastPost;
|
||||
|
||||
/**
|
||||
* @var ForumPost $lastPost
|
||||
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="last_post_id")
|
||||
*/
|
||||
protected $lastPost;
|
||||
/**
|
||||
* Set lastPost
|
||||
*
|
||||
* @param ForumPost $lastPost
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setLastPost($lastPost = null)
|
||||
{
|
||||
$this->lastPost = $lastPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lastPost
|
||||
*
|
||||
* @param ForumPost $lastPost
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setLastPost($lastPost = null)
|
||||
{
|
||||
$this->lastPost = $lastPost;
|
||||
}
|
||||
/**
|
||||
* Get lastPost
|
||||
*
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function getLastPost()
|
||||
{
|
||||
return $this->lastPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastPost
|
||||
*
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function getLastPost()
|
||||
{
|
||||
return $this->lastPost;
|
||||
}
|
||||
/**
|
||||
* The list of all the ForumPosts in this topic
|
||||
*
|
||||
* @var ArrayCollection $topics;
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic", fetch="LAZY")
|
||||
*/
|
||||
protected $posts;
|
||||
|
||||
/**
|
||||
* @var ArrayCollection $topics;
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
|
||||
*/
|
||||
protected $posts;
|
||||
/**
|
||||
* Add post
|
||||
*
|
||||
* @param ForumPost $post
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function addPost(ForumPost $post)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->posts[] = $post;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add post
|
||||
*
|
||||
* @param ForumPost $post
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function addPost(ForumPost $post)
|
||||
{
|
||||
$this->posts[] = $post;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get posts
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getPosts()
|
||||
{
|
||||
return $this->posts;
|
||||
}
|
||||
/**
|
||||
* Get posts
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getPosts()
|
||||
{
|
||||
return $this->posts;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -14,168 +14,189 @@ use KekRozsak\SecurityBundle\Entity\User;
|
||||
*/
|
||||
class ForumTopicGroup
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->topics = new ArrayCollection();
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->topics = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the ForumTopicGroup
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
/**
|
||||
* The User who created this ForumTopicGroup
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
/**
|
||||
* The timestamp when this ForumTopicGroup was created
|
||||
*
|
||||
* @var DateTime $createdAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $slug;
|
||||
/**
|
||||
* The slugified title of this ForumTopicGroup
|
||||
*
|
||||
* @var string $slug
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $title;
|
||||
/**
|
||||
* The title of this ForumTopicGroup
|
||||
*
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ArrayCollection $topics
|
||||
* @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
|
||||
*/
|
||||
protected $topics;
|
||||
/**
|
||||
* The ArrayCollection of ForumTopics that belong to this ForumTopicGroup
|
||||
*
|
||||
* @var ArrayCollection $topics
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
|
||||
*/
|
||||
protected $topics;
|
||||
|
||||
/**
|
||||
* Add topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function addTopic(ForumTopic $topic)
|
||||
{
|
||||
$this->topics[] = $topic;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function addTopic(ForumTopic $topic)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->topics[] = $topic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topics
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getTopics()
|
||||
{
|
||||
return $this->topics;
|
||||
}
|
||||
/**
|
||||
* Get topics
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getTopics()
|
||||
{
|
||||
return $this->topics;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,325 +19,357 @@ use KekRozsak\FrontBundle\Entity\Document;
|
||||
*/
|
||||
class Group
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->members = new ArrayCollection();
|
||||
$this->documents = new ArrayCollection();
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->members = new ArrayCollection();
|
||||
$this->documents = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of this Group
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $leader
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
*/
|
||||
protected $leader;
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $leader
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
*/
|
||||
protected $leader;
|
||||
|
||||
/**
|
||||
* Set leader
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $leader
|
||||
* @return Group
|
||||
*/
|
||||
public function setLeader(\KekRozsak\SecurityBundle\Entity\User $leader = null)
|
||||
{
|
||||
$this->leader = $leader;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set leader
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $leader
|
||||
* @return Group
|
||||
*/
|
||||
public function setLeader(User $leader = null)
|
||||
{
|
||||
$this->leader = $leader;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get leader
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getLeader()
|
||||
{
|
||||
return $this->leader;
|
||||
}
|
||||
/**
|
||||
* Get leader
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getLeader()
|
||||
{
|
||||
return $this->leader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $name
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
/**
|
||||
* The name of this Group
|
||||
*
|
||||
* @var string $name
|
||||
*
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
* @return Group
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
* @return Group
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
*/
|
||||
protected $slug;
|
||||
/**
|
||||
* The slugified name of this Group
|
||||
*
|
||||
* @var string $slug
|
||||
*
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Group
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return Group
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
/**
|
||||
* The User who created this Group
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Group
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Group
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
/**
|
||||
* The timestamp when this Group was created
|
||||
*
|
||||
* @var DateTime $createdAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Group
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Group
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $members
|
||||
* @ORM\OneToMany(targetEntity="UserGroupMembership", mappedBy="group")
|
||||
*/
|
||||
protected $members;
|
||||
/**
|
||||
* An ArrayCollection of UserGroupMemberships representing the Group's
|
||||
* members
|
||||
*
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $members
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="UserGroupMembership", mappedBy="group")
|
||||
*/
|
||||
protected $members;
|
||||
|
||||
/**
|
||||
* Add member
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $member
|
||||
* @return Group
|
||||
*/
|
||||
public function addMember(\KekRozsak\FrontBundle\Entity\UserGroupMembership $member)
|
||||
{
|
||||
$this->members[] = $member;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add member
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\UserGroupMembership $member
|
||||
* @return Group
|
||||
*/
|
||||
public function addMember(UserGroupMembership $member)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->members[] = $member;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all members
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getMembers()
|
||||
{
|
||||
return $this->members;
|
||||
}
|
||||
/**
|
||||
* Get all members
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getMembers()
|
||||
{
|
||||
return $this->members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is a member of this Group
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isMember(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
return ($this->members->filter(
|
||||
function ($groupMembership) use ($user) {
|
||||
return (
|
||||
($groupMembership->getUser() == $user)
|
||||
&& (
|
||||
$groupMembership->getGroup()->isOpen()
|
||||
|| ($groupMembership->getMembershipAcceptedAt() !== null)
|
||||
)
|
||||
);
|
||||
}
|
||||
)->count() > 0);
|
||||
}
|
||||
/**
|
||||
* Check if user is a member of this Group
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isMember(User $user)
|
||||
{
|
||||
return ($this->members->filter(function ($groupMembership) use ($user)
|
||||
{
|
||||
return (
|
||||
($groupMembership->getUser() == $user)
|
||||
&& (
|
||||
$groupMembership->getGroup()->isOpen()
|
||||
|| ($groupMembership->getMembershipAcceptedAt() !== null)
|
||||
)
|
||||
);
|
||||
})->count() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user already requested a membership in this Group
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRequested(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
return ($this->members->filter(
|
||||
function ($groupMembership) use ($user) {
|
||||
return (
|
||||
($groupMembership->getUser() == $user)
|
||||
&& ($groupMembership->getMembershipRequestedAt() !== null)
|
||||
);
|
||||
}
|
||||
)->count() > 0);
|
||||
}
|
||||
/**
|
||||
* Check if user already requested a membership in this Group
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRequested(User $user)
|
||||
{
|
||||
return ($this->members->filter(function ($groupMembership) use ($user)
|
||||
{
|
||||
return (
|
||||
($groupMembership->getUser() == $user)
|
||||
&& ($groupMembership->getMembershipRequestedAt() !== null)
|
||||
);
|
||||
})->count() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string description
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
protected $description;
|
||||
/**
|
||||
* The description of the Group
|
||||
*
|
||||
* @var string description
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
* @return Group
|
||||
*/
|
||||
public function setDescription($description = null)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
* @return Group
|
||||
*/
|
||||
public function setDescription($description = null)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean open
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $open;
|
||||
/**
|
||||
* TRUE if this Group is open, and anyone can join
|
||||
*
|
||||
* @var boolean open
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $open;
|
||||
|
||||
/**
|
||||
* Set open
|
||||
*
|
||||
* @param boolean $open
|
||||
* @ return Group
|
||||
*/
|
||||
public function setOpen($open = false)
|
||||
{
|
||||
$this->open = $open;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set open
|
||||
*
|
||||
* @param boolean $open
|
||||
* @ return Group
|
||||
*/
|
||||
public function setOpen($open = false)
|
||||
{
|
||||
$this->open = $open;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get open
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOpen()
|
||||
{
|
||||
return $this->open;
|
||||
}
|
||||
/**
|
||||
* Get open
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOpen()
|
||||
{
|
||||
return $this->open;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $documents
|
||||
* @ORM\ManyToMany(targetEntity="Document", inversedBy="groups")
|
||||
* @ORM\JoinTable(name="group_document", inverseJoinColumns={
|
||||
* @ORM\JoinColumn(name="document_id", referencedColumnName="id"),
|
||||
* }, joinColumns={
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
protected $documents;
|
||||
/**
|
||||
* An ArrayCollection of Documents that belong to this Group
|
||||
*
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $documents
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="Document", inversedBy="groups", fetch="LAZY")
|
||||
* @ORM\JoinTable(name="group_document", inverseJoinColumns={
|
||||
* @ORM\JoinColumn(name="document_id", referencedColumnName="id"),
|
||||
* }, joinColumns={
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
protected $documents;
|
||||
|
||||
/**
|
||||
* Add document
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Document $document
|
||||
* @return Group
|
||||
*/
|
||||
public function addDocument(\KekRozsak\FrontBundle\Entity\Document $document)
|
||||
{
|
||||
$this->documents[] = $document;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add document
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Document $document
|
||||
* @return Group
|
||||
*/
|
||||
public function addDocument(Document $document)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->documents[] = $document;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all documents
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getDocuments()
|
||||
{
|
||||
return $this->documents;
|
||||
}
|
||||
/**
|
||||
* Get all documents
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getDocuments()
|
||||
{
|
||||
return $this->documents;
|
||||
}
|
||||
}
|
||||
|
@@ -4,169 +4,192 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="news")
|
||||
*/
|
||||
class News
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of this News
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100)
|
||||
*/
|
||||
protected $title;
|
||||
/**
|
||||
* The title of this News
|
||||
*
|
||||
* @var string $title
|
||||
*
|
||||
* @ORM\Column(type="string", length=100)
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return News
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return News
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
// TODO: Check if empty or null!
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $text;
|
||||
/**
|
||||
* The contents of this News
|
||||
*
|
||||
* @var string $text
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
protected $text;
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @return News
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @return News
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
/**
|
||||
* The timestamp when this News was created
|
||||
*
|
||||
* @var DateTime $createdAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
protected $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
/**
|
||||
* The User who created this News item
|
||||
*
|
||||
* @var \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
protected $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $public
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $public;
|
||||
/**
|
||||
* TRUE if this News item is public
|
||||
*
|
||||
* @var boolean $public
|
||||
*
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
protected $public;
|
||||
|
||||
/**
|
||||
* Set public
|
||||
*
|
||||
* @param boolean $public
|
||||
* @return News
|
||||
*/
|
||||
public function setPublic($public)
|
||||
{
|
||||
$this->public = $public;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set public
|
||||
*
|
||||
* @param boolean $public
|
||||
* @return News
|
||||
*/
|
||||
public function setPublic($public)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->public = $public;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get public
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPublic()
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
/**
|
||||
* Get public
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPublic()
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
}
|
||||
|
@@ -13,380 +13,430 @@ use \KekRozsak\SecurityBundle\Entity\User;
|
||||
*/
|
||||
class UserData
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->emailPublic = false;
|
||||
$this->realNamePublic = false;
|
||||
$this->msnAddressPublic = false;
|
||||
$this->googleTalkPublic = false;
|
||||
$this->skypePublic = false;
|
||||
$this->phoneNumberPublic = false;
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->emailPublic = false;
|
||||
$this->realNamePublic = false;
|
||||
$this->msnAddressPublic = false;
|
||||
$this->googleTalkPublic = false;
|
||||
$this->skypePublic = false;
|
||||
$this->phoneNumberPublic = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="NONE")
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected $user;
|
||||
/**
|
||||
* The User object this UserData belongs to
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $user
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="NONE")
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserData
|
||||
*/
|
||||
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserData
|
||||
*/
|
||||
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $emailPublic
|
||||
* @ORM\Column(type="boolean", name="email_public")
|
||||
*/
|
||||
protected $emailPublic;
|
||||
/**
|
||||
* TRUE if $user's e-mail address is public
|
||||
*
|
||||
* @var boolean $emailPublic
|
||||
*
|
||||
* @ORM\Column(type="boolean", name="email_public")
|
||||
*/
|
||||
protected $emailPublic;
|
||||
|
||||
/**
|
||||
* Set emailPublic
|
||||
*
|
||||
* @param boolean $emailPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setEmailPublic($emailPublic)
|
||||
{
|
||||
$this->emailPublic = $emailPublic;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set emailPublic
|
||||
*
|
||||
* @param boolean $emailPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setEmailPublic($emailPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->emailPublic = $emailPublic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get emailPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getEmailPublic()
|
||||
{
|
||||
return $this->emailPublic;
|
||||
}
|
||||
/**
|
||||
* Get emailPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEmailPublic()
|
||||
{
|
||||
return $this->emailPublic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $realName
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="real_name")
|
||||
*/
|
||||
protected $realName;
|
||||
/**
|
||||
* The real name of $user
|
||||
*
|
||||
* @var string $realName
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="real_name")
|
||||
*/
|
||||
protected $realName;
|
||||
|
||||
/**
|
||||
* Set realName
|
||||
*
|
||||
* @param string $realName
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealName($realName = null)
|
||||
{
|
||||
$this->realName = $realName;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set realName
|
||||
*
|
||||
* @param string $realName
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealName($realName = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->realName = $realName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get realName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRealName()
|
||||
{
|
||||
return $this->realName;
|
||||
}
|
||||
/**
|
||||
* Get realName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRealName()
|
||||
{
|
||||
return $this->realName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $realNamePublic
|
||||
* @ORM\Column(type="boolean", name="real_name_public")
|
||||
*/
|
||||
protected $realNamePublic;
|
||||
/**
|
||||
* TRUE is $user's real name is public
|
||||
*
|
||||
* @var boolean $realNamePublic
|
||||
*
|
||||
* @ORM\Column(type="boolean", name="real_name_public")
|
||||
*/
|
||||
protected $realNamePublic;
|
||||
|
||||
/**
|
||||
* Set realNamePublic
|
||||
*
|
||||
* @param boolean $realNamePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealNamePublic($realNamePublic = false)
|
||||
{
|
||||
$this->realNamePublic = $realNamePublic;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set realNamePublic
|
||||
*
|
||||
* @param boolean $realNamePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealNamePublic($realNamePublic = false)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->realNamePublic = $realNamePublic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get realNamePublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRealNamePublic()
|
||||
{
|
||||
return $this->realNamePublic;
|
||||
}
|
||||
/**
|
||||
* Get realNamePublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRealNamePublic()
|
||||
{
|
||||
return $this->realNamePublic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $selfDescription
|
||||
* @ORM\Column(type="text", nullable=true, name="self_description")
|
||||
*/
|
||||
protected $selfDescription;
|
||||
/**
|
||||
* The self description of $user
|
||||
*
|
||||
* @var string $selfDescription
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=true, name="self_description")
|
||||
*/
|
||||
protected $selfDescription;
|
||||
|
||||
/**
|
||||
* Set selfDescription
|
||||
*
|
||||
* @param string $selfDescription
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSelfDescription($selfDescription = null)
|
||||
{
|
||||
$this->selfDescription = $selfDescription;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set selfDescription
|
||||
*
|
||||
* @param string $selfDescription
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSelfDescription($selfDescription = null)
|
||||
{
|
||||
$this->selfDescription = $selfDescription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get selfDescription
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSelfDescription()
|
||||
{
|
||||
return $this->selfDescription;
|
||||
}
|
||||
/**
|
||||
* Get selfDescription
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSelfDescription()
|
||||
{
|
||||
return $this->selfDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $msnAddress
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="msn_address")
|
||||
*/
|
||||
protected $msnAddress;
|
||||
/**
|
||||
* The MSN address of $user
|
||||
*
|
||||
* @var string $msnAddress
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="msn_address")
|
||||
*/
|
||||
protected $msnAddress;
|
||||
|
||||
/**
|
||||
* Set msnAddress
|
||||
*
|
||||
* @param string $msnAddress
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddress($msnAddress = null)
|
||||
{
|
||||
$this->msnAddress = $msnAddress;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set msnAddress
|
||||
*
|
||||
* @param string $msnAddress
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddress($msnAddress = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->msnAddress = $msnAddress;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get msnAddress
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMsnAddress()
|
||||
{
|
||||
return $this->msnAddress;
|
||||
}
|
||||
/**
|
||||
* Get msnAddress
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMsnAddress()
|
||||
{
|
||||
return $this->msnAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $msnAddressPublic
|
||||
* @ORM\Column(type="boolean", name="msn_address_public")
|
||||
*/
|
||||
protected $msnAddressPublic;
|
||||
/**
|
||||
* TRUE if $user's MSN address is public
|
||||
*
|
||||
* @var boolean $msnAddressPublic
|
||||
*
|
||||
* @ORM\Column(type="boolean", name="msn_address_public")
|
||||
*/
|
||||
protected $msnAddressPublic;
|
||||
|
||||
/**
|
||||
* Set msnAddressPublic
|
||||
*
|
||||
* @param boolean $msnAddressPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddressPublic($msnAddressPublic)
|
||||
{
|
||||
$this->msnAddressPublic = $msnAddressPublic;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set msnAddressPublic
|
||||
*
|
||||
* @param boolean $msnAddressPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddressPublic($msnAddressPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->msnAddressPublic = $msnAddressPublic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get msnAddressPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getMsnAddressPublic()
|
||||
{
|
||||
return $this->msnAddressPublic;
|
||||
}
|
||||
/**
|
||||
* Get msnAddressPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isMsnAddressPublic()
|
||||
{
|
||||
return $this->msnAddressPublic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $googleTalk
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="google_talk")
|
||||
*/
|
||||
protected $googleTalk;
|
||||
/**
|
||||
* Google Talk address of $user
|
||||
*
|
||||
* @var string $googleTalk
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="google_talk")
|
||||
*/
|
||||
protected $googleTalk;
|
||||
|
||||
/**
|
||||
* Set googleTalk
|
||||
*
|
||||
* @param string $googleTalk
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalk($googleTalk = null)
|
||||
{
|
||||
$this->googleTalk = $googleTalk;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set googleTalk
|
||||
*
|
||||
* @param string $googleTalk
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalk($googleTalk = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->googleTalk = $googleTalk;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get googleTalk
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGoogleTalk()
|
||||
{
|
||||
return $this->googleTalk;
|
||||
}
|
||||
/**
|
||||
* Get googleTalk
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGoogleTalk()
|
||||
{
|
||||
return $this->googleTalk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $googleTalkPublic
|
||||
* @ORM\Column(type="boolean", name="google_talk_public")
|
||||
*/
|
||||
protected $googleTalkPublic;
|
||||
/**
|
||||
* TRUE if $user's Google Talk address is public
|
||||
*
|
||||
* @var boolean $googleTalkPublic
|
||||
*
|
||||
* @ORM\Column(type="boolean", name="google_talk_public")
|
||||
*/
|
||||
protected $googleTalkPublic;
|
||||
|
||||
/**
|
||||
* Set googleTalkPublic
|
||||
*
|
||||
* @param boolean $googleTalkPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalkPublic($googleTalkPublic)
|
||||
{
|
||||
$this->googleTalkPublic = $googleTalkPublic;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set googleTalkPublic
|
||||
*
|
||||
* @param boolean $googleTalkPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalkPublic($googleTalkPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->googleTalkPublic = $googleTalkPublic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get googleTalkPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getGoogleTalkPublic()
|
||||
{
|
||||
return $this->googleTalkPublic;
|
||||
}
|
||||
/**
|
||||
* Get googleTalkPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isGoogleTalkPublic()
|
||||
{
|
||||
return $this->googleTalkPublic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $skype
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="skype")
|
||||
*/
|
||||
protected $skype;
|
||||
/**
|
||||
* Skype name of $user
|
||||
*
|
||||
* @var string $skype
|
||||
*
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="skype")
|
||||
*/
|
||||
protected $skype;
|
||||
|
||||
/**
|
||||
* Set skype
|
||||
*
|
||||
* @param string $skype
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkype($skype = null)
|
||||
{
|
||||
$this->skype = $skype;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set skype
|
||||
*
|
||||
* @param string $skype
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkype($skype = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->skype = $skype;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get skype
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSkype()
|
||||
{
|
||||
return $this->skype;
|
||||
}
|
||||
/**
|
||||
* Get skype
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSkype()
|
||||
{
|
||||
return $this->skype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $skypePublic
|
||||
* @ORM\Column(type="boolean", name="skype_public")
|
||||
*/
|
||||
protected $skypePublic;
|
||||
/**
|
||||
* TRUE if $user's Skype name is public
|
||||
*
|
||||
* @var boolean $skypePublic
|
||||
*
|
||||
* @ORM\Column(type="boolean", name="skype_public")
|
||||
*/
|
||||
protected $skypePublic;
|
||||
|
||||
/**
|
||||
* Set skypePublic
|
||||
*
|
||||
* @param boolean $skypePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkypePublic($skypePublic)
|
||||
{
|
||||
$this->skypePublic = $skypePublic;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set skypePublic
|
||||
*
|
||||
* @param boolean $skypePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkypePublic($skypePublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->skypePublic = $skypePublic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get skypePublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getSkypePublic()
|
||||
{
|
||||
return $this->skypePublic;
|
||||
}
|
||||
/**
|
||||
* Get skypePublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSkypePublic()
|
||||
{
|
||||
return $this->skypePublic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $phoneNumber
|
||||
* @ORM\Column(type="string", length=30, nullable=true, name="phone_number")
|
||||
*/
|
||||
protected $phoneNumber;
|
||||
/**
|
||||
* Phone number of $user
|
||||
*
|
||||
* @var string $phoneNumber
|
||||
*
|
||||
* @ORM\Column(type="string", length=30, nullable=true, name="phone_number")
|
||||
*/
|
||||
protected $phoneNumber;
|
||||
|
||||
/**
|
||||
* Set phoneNumber
|
||||
*
|
||||
* @param string $phoneNumber
|
||||
* @return UserData
|
||||
*/
|
||||
public function setPhoneNumber($phoneNumber = null)
|
||||
{
|
||||
$this->phoneNumber = $phoneNumber;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set phoneNumber
|
||||
*
|
||||
* @param string $phoneNumber
|
||||
* @return UserData
|
||||
*/
|
||||
public function setPhoneNumber($phoneNumber = null)
|
||||
{
|
||||
// TODO: Check if empty!
|
||||
$this->phoneNumber = $phoneNumber;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get phoneNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPhoneNumber()
|
||||
{
|
||||
return $this->phoneNumber;
|
||||
}
|
||||
/**
|
||||
* Get phoneNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPhoneNumber()
|
||||
{
|
||||
return $this->phoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $phoneNumberPublic
|
||||
* @ORM\Column(type="boolean", name="phone_number_public")
|
||||
*/
|
||||
protected $phoneNumberPublic;
|
||||
/**
|
||||
* TRUE if $user's phone number is public
|
||||
*
|
||||
* @var boolean $phoneNumberPublic
|
||||
*
|
||||
* @ORM\Column(type="boolean", name="phone_number_public")
|
||||
*/
|
||||
protected $phoneNumberPublic;
|
||||
|
||||
/**
|
||||
* Set phoneNumberPublic
|
||||
*
|
||||
* @param boolean $phoneNumberPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setPhoneNumberPublic($phoneNumberPublic)
|
||||
{
|
||||
$this->phoneNumberPublic = $phoneNumberPublic;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set phoneNumberPublic
|
||||
*
|
||||
* @param boolean $phoneNumberPublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setPhoneNumberPublic($phoneNumberPublic)
|
||||
{
|
||||
// TODO: Check if parameter is boolean!
|
||||
$this->phoneNumberPublic = $phoneNumberPublic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get phoneNumberPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPhoneNumberPublic()
|
||||
{
|
||||
return $this->phoneNumberPublic;
|
||||
}
|
||||
/**
|
||||
* Get phoneNumberPublic
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPhoneNumberPublic()
|
||||
{
|
||||
return $this->phoneNumberPublic;
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Entity\Group;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\UserGroupMembership
|
||||
@@ -15,171 +16,191 @@ use KekRozsak\SecurityBundle\Entity\User;
|
||||
*/
|
||||
class UserGroupMembership
|
||||
{
|
||||
public function __construct(\KekRozsak\SecurityBundle\Entity\User $user, \KekRozsak\FrontBundle\Entity\Group $group)
|
||||
{
|
||||
$this->setUser($user);
|
||||
$this->setGroup($group);
|
||||
$this->setMembershipRequestedAt(new \DateTime('now'));
|
||||
}
|
||||
public function __construct(\KekRozsak\SecurityBundle\Entity\User $user, \KekRozsak\FrontBundle\Entity\Group $group)
|
||||
{
|
||||
$this->setUser($user);
|
||||
$this->setGroup($group);
|
||||
$this->setMembershipRequestedAt(new \DateTime('now'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* The ID of the UserGroupMembership
|
||||
*
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="groups")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected $user;
|
||||
/**
|
||||
* The User this membership is applied to
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $user
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="groups")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
// TODO: Check if not null!
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\FrontBundle\Entity\Group
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="members")
|
||||
* @ORM\JoinColumn(name="group_id")
|
||||
*/
|
||||
protected $group;
|
||||
/**
|
||||
* The Group this membership is applied to
|
||||
*
|
||||
* @var KekRozsak\FrontBundle\Entity\Group
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="members")
|
||||
* @ORM\JoinColumn(name="group_id")
|
||||
*/
|
||||
protected $group;
|
||||
|
||||
/**
|
||||
* Set group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setGroup(\KekRozsak\FrontBundle\Entity\Group $group)
|
||||
{
|
||||
$this->group = $group;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set group
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\Group
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setGroup(Group $group)
|
||||
{
|
||||
$this->group = $group;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group
|
||||
*
|
||||
* @return KekRozsak\FrontBundle\Entity\Group
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
/**
|
||||
* Get group
|
||||
*
|
||||
* @return KekRozsak\FrontBundle\Entity\Group
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $membershipRequestedAt
|
||||
* @ORM\Column(type="datetime", name="membership_requested_at")
|
||||
*/
|
||||
protected $membershipRequestedAt;
|
||||
/**
|
||||
* The timestamp when $user requested membership in $group
|
||||
*
|
||||
* @var DateTime $membershipRequestedAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", name="membership_requested_at")
|
||||
*/
|
||||
protected $membershipRequestedAt;
|
||||
|
||||
/**
|
||||
* Set membershipRequestedAt
|
||||
*
|
||||
* @param DateTime $membershipRequestedAt
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipRequestedAt(\DateTime $membershipRequestedAt)
|
||||
{
|
||||
$this->membershipRequestedAt = $membershipRequestedAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set membershipRequestedAt
|
||||
*
|
||||
* @param DateTime $membershipRequestedAt
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipRequestedAt(\DateTime $membershipRequestedAt)
|
||||
{
|
||||
// TODO: Check if null!
|
||||
$this->membershipRequestedAt = $membershipRequestedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get membershipRequestedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getMembershipRequestedAt()
|
||||
{
|
||||
return $this->membershipRequestedAt;
|
||||
}
|
||||
/**
|
||||
* Get membershipRequestedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getMembershipRequestedAt()
|
||||
{
|
||||
return $this->membershipRequestedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime membershipAcceptedAt
|
||||
* @ORM\Column(type="datetime", nullable=true, name="membership_accepted_at")
|
||||
*/
|
||||
protected $membershipAcceptedAt;
|
||||
/**
|
||||
* The timestamp when $user's membership was accepted
|
||||
*
|
||||
* @var DateTime membershipAcceptedAt
|
||||
*
|
||||
* @ORM\Column(type="datetime", nullable=true, name="membership_accepted_at")
|
||||
*/
|
||||
protected $membershipAcceptedAt;
|
||||
|
||||
/**
|
||||
* Set membershipAcceptedAt
|
||||
*
|
||||
* @param DateTime $membershipAcceptedAt
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipAcceptedAt(\DateTime $membershipAcceptedAt = null)
|
||||
{
|
||||
$this->membershipAcceptedAt = $membershipAcceptedAt;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set membershipAcceptedAt
|
||||
*
|
||||
* @param DateTime $membershipAcceptedAt
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipAcceptedAt(\DateTime $membershipAcceptedAt = null)
|
||||
{
|
||||
$this->membershipAcceptedAt = $membershipAcceptedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get membershipAcceptedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getMembershipAcceptedAt()
|
||||
{
|
||||
return $this->membershipAcceptedAt;
|
||||
}
|
||||
/**
|
||||
* Get membershipAcceptedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getMembershipAcceptedAt()
|
||||
{
|
||||
return $this->membershipAcceptedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="membership_accepted_by_id")
|
||||
*/
|
||||
protected $membershipAcceptedBy;
|
||||
|
||||
/**
|
||||
* Set membershipAcceptedBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipAcceptedBy(\KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy = null)
|
||||
{
|
||||
$this->membershipAcceptedBy = $membershipAcceptedBy;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* The User who accepted $user's membership
|
||||
*
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="membership_accepted_by_id")
|
||||
*/
|
||||
protected $membershipAcceptedBy;
|
||||
|
||||
/**
|
||||
* Get membershipAcceptedBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getMembershipAcceptedBy()
|
||||
{
|
||||
return $this->membershipAcceptedBy;
|
||||
}
|
||||
/**
|
||||
* Set membershipAcceptedBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User
|
||||
* @return UserGroupMembership
|
||||
*/
|
||||
public function setMembershipAcceptedBy(\KekRozsak\SecurityBundle\Entity\User $membershipAcceptedBy = null)
|
||||
{
|
||||
$this->membershipAcceptedBy = $membershipAcceptedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get membershipAcceptedBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getMembershipAcceptedBy()
|
||||
{
|
||||
return $this->membershipAcceptedBy;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user