* uplift to latest expressive

This commit is contained in:
Danyi Dávid
2017-11-06 13:18:39 +01:00
parent b5c307166e
commit 8c5b58acd1
44 changed files with 3419 additions and 1022 deletions

305
src/App/Entity/Activity.php Normal file
View File

@@ -0,0 +1,305 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
class Activity implements \JsonSerializable
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $name;
/**
* @var \DateTime
*/
private $date;
/**
* @var string
*/
private $description;
/**
* @var \DateTime
*/
private $finalEntry;
/**
* @var string
*/
private $accountable;
/**
* @var ArrayCollection|Comment[]
*/
private $comments;
/**
* @var string[]
*/
private $signedUsers;
/**
* @var bool
*/
private $isSignedup = false;
/**
* Can sign up or sign off activity
* @var bool
*/
private $canChangeSignup = false;
public function __construct()
{
$this->comments = new ArrayCollection();
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Activity
*/
public function setId(int $id)
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return Activity
*/
public function setName(?string $name): Activity
{
$this->name = $name;
return $this;
}
/**
* @return \DateTime
*/
public function getDate(): ?\DateTime
{
return $this->date;
}
/**
* @param \DateTime $date
* @return Activity
*/
public function setDate(?\DateTime $date): Activity
{
$this->date = $date;
return $this;
}
/**
* @return string
*/
public function getDescription(): ?string
{
return $this->description;
}
/**
* @param string $description
* @return Activity
*/
public function setDescription(?string $description): Activity
{
$this->description = $description;
return $this;
}
/**
* @return \DateTime
*/
public function getFinalEntry(): ?\DateTime
{
return $this->finalEntry;
}
/**
* @param \DateTime $finalEntry
* @return Activity
*/
public function setFinalEntry(\DateTime $finalEntry): Activity
{
$this->finalEntry = $finalEntry;
return $this;
}
/**
* @return string
*/
public function getAccountable(): ?string
{
return $this->accountable;
}
/**
* @param string $accountable
* @return Activity
*/
public function setAccountable(string $accountable): Activity
{
$this->accountable = $accountable;
return $this;
}
/**
* @return Comment[]|ArrayCollection
*/
public function getComments()
{
return $this->comments;
}
/**
* @param Comment[]|ArrayCollection $comments
* @return Activity
*/
public function setComments($comments): Activity
{
$this->comments = $comments;
return $this;
}
/**
* @param Comment $comment
* @return Activity
*/
public function addComment(Comment $comment): Activity
{
if(!$this->comments->contains($comment)) {
$this->comments->add($comment);
}
return $this;
}
/**
* @param Comment $comment
* @return Activity
*/
public function removeComment(Comment $comment): Activity
{
if($this->comments->contains($comment)) {
$this->comments->removeElement($comment);
}
return $this;
}
/**
* @return string[]
*/
public function getSignedUsers(): ?array
{
return $this->signedUsers;
}
/**
* @param string[] $signedUsers
* @return Activity
*/
public function setSignedUsers(array $signedUsers): Activity
{
$this->signedUsers = $signedUsers;
return $this;
}
/**
* @param string $signed
* @return Activity
*/
public function addSignedUser(string $signed): Activity
{
$this->signedUsers[] = $signed;
return $this;
}
/**
* @return bool
*/
public function isSignedup(): bool
{
return $this->isSignedup;
}
/**
* @param bool $isSignedup
* @return Activity
*/
public function setIsSignedup(bool $isSignedup): Activity
{
$this->isSignedup = $isSignedup;
return $this;
}
/**
* @return bool
*/
public function isCanChangeSignup(): bool
{
return $this->canChangeSignup;
}
/**
* @param bool $canChangeSignup
* @return Activity
*/
public function setCanChangeSignup(bool $canChangeSignup): Activity
{
$this->canChangeSignup = $canChangeSignup;
return $this;
}
/**
* Specify data which should be serialized to JSON
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
* @since 5.4.0
*/
public function jsonSerialize()
{
return [
'id' => $this->getId(),
'name' => $this->getName(),
'date' => $this->getDate()
? $this->getDate()->format("Y-m-d H:i:s")
: null,
'description' => $this->getDescription(),
'finalEntry' => $this->getFinalEntry()
? $this->getFinalEntry()->format("Y-m-d H:i:s")
: null,
'accountable' => $this->getAccountable(),
'comments' => $this->getComments()->getValues(),
'signedUsers' => $this->getSignedUsers(),
'canChangeSignup' => $this->isCanChangeSignup(),
'isSignedUp' => $this->isSignedup()
];
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace App\Entity;
class Comment implements \JsonSerializable
{
/**
* @var string
*/
private $text;
/**
* @var \DateTime
*/
private $createdAt;
/**
* @var User
*/
private $user;
/**
* @return string
*/
public function getText(): string
{
return $this->text;
}
/**
* @param string $text
* @return Comment
*/
public function setText(string $text): Comment
{
$this->text = $text;
return $this;
}
/**
* @return \DateTime
*/
public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}
/**
* @param \DateTime $createdAt
* @return Comment
*/
public function setCreatedAt(\DateTime $createdAt): Comment
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return User
*/
public function getUser(): User
{
return $this->user;
}
/**
* @param User $user
* @return Comment
*/
public function setUser(User $user): Comment
{
$this->user = $user;
return $this;
}
/**
* Specify data which should be serialized to JSON
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
* @since 5.4.0
*/
public function jsonSerialize()
{
return [
'text' => $this->getText(),
'user' => $this->getUser(),
'createdAt' => $this->getCreatedAt()
? $this->getCreatedAt()->format("Y-m-d H:i:s")
: null,
];
}
}

8
src/App/Entity/News.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
namespace App\Entity;
class News
{
}

67
src/App/Entity/User.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
namespace App\Entity;
class User implements \JsonSerializable
{
/**
* @var string
*/
private $username;
/**
* @var string
*/
private $displayName;
/**
* @return string
*/
public function getUsername(): string
{
return $this->username;
}
/**
* @param string $username
* @return User
*/
public function setUsername(string $username): User
{
$this->username = $username;
return $this;
}
/**
* @return string
*/
public function getDisplayName(): string
{
return $this->displayName;
}
/**
* @param string $displayName
* @return User
*/
public function setDisplayName(string $displayName): User
{
$this->displayName = $displayName;
return $this;
}
/**
* Specify data which should be serialized to JSON
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
* @since 5.4.0
*/
public function jsonSerialize()
{
return [
'username' => $this->getUsername(),
'displayName' => $this->getDisplayName(),
];
}
}