From 34812dd1bd848453fa82073926380b0059ee7ba0 Mon Sep 17 00:00:00 2001 From: Pavel Date: Wed, 26 Jun 2019 11:17:49 +0300 Subject: [PATCH] Removed CommonFields from models, MessageOrderPaymentStatus getter fix --- src/Bot/Model/Entity/Bot.php | 74 +++++++++++- src/Bot/Model/Entity/Channel/Channel.php | 74 +++++++++++- src/Bot/Model/Entity/Chat/Chat.php | 74 +++++++++++- src/Bot/Model/Entity/Chat/ChatMember.php | 74 +++++++++++- src/Bot/Model/Entity/Command.php | 73 +++++++++++- src/Bot/Model/Entity/CommonFields.php | 107 ------------------ src/Bot/Model/Entity/Customer.php | 73 +++++++++++- src/Bot/Model/Entity/Dialog.php | 73 +++++++++++- src/Bot/Model/Entity/Message/Message.php | 74 +++++++++++- .../Message/MessageOrderPaymentStatus.php | 5 +- .../Model/Entity/Message/MessageQuantity.php | 3 - src/Bot/Model/Entity/User.php | 73 +++++++++++- 12 files changed, 649 insertions(+), 128 deletions(-) delete mode 100644 src/Bot/Model/Entity/CommonFields.php diff --git a/src/Bot/Model/Entity/Bot.php b/src/Bot/Model/Entity/Bot.php index 54b205c..fcd029f 100644 --- a/src/Bot/Model/Entity/Bot.php +++ b/src/Bot/Model/Entity/Bot.php @@ -29,7 +29,31 @@ use JMS\Serializer\Annotation\Type; */ class Bot { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + * @SkipWhenEmpty() + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + * @SkipWhenEmpty() + */ + private $updatedAt; /** * @var string $name @@ -112,6 +136,54 @@ class Bot */ private $isSystem; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return string */ diff --git a/src/Bot/Model/Entity/Channel/Channel.php b/src/Bot/Model/Entity/Channel/Channel.php index 22ec381..716a488 100644 --- a/src/Bot/Model/Entity/Channel/Channel.php +++ b/src/Bot/Model/Entity/Channel/Channel.php @@ -13,7 +13,7 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Channel; -use RetailCrm\Mg\Bot\Model\Entity\CommonFields; +use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\Type; @@ -29,7 +29,29 @@ use JMS\Serializer\Annotation\Type; */ class Channel { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + */ + private $updatedAt; /** * @var \DateTime $activatedAt @@ -79,6 +101,54 @@ class Channel */ private $name; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return \DateTime */ diff --git a/src/Bot/Model/Entity/Chat/Chat.php b/src/Bot/Model/Entity/Chat/Chat.php index ab9215b..dd628e5 100644 --- a/src/Bot/Model/Entity/Chat/Chat.php +++ b/src/Bot/Model/Entity/Chat/Chat.php @@ -13,9 +13,7 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Chat; -use JMS\Serializer\Annotation as Serializer; use RetailCrm\Mg\Bot\Model\Entity\Channel\Channel; -use RetailCrm\Mg\Bot\Model\Entity\CommonFields; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; @@ -33,7 +31,29 @@ use RetailCrm\Mg\Bot\Model\Entity\Customer; */ class Chat { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + */ + private $updatedAt; /** * @var string $avatar @@ -100,6 +120,54 @@ class Chat */ private $lastActivity; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return string */ diff --git a/src/Bot/Model/Entity/Chat/ChatMember.php b/src/Bot/Model/Entity/Chat/ChatMember.php index 6c3d06d..3d71d91 100644 --- a/src/Bot/Model/Entity/Chat/ChatMember.php +++ b/src/Bot/Model/Entity/Chat/ChatMember.php @@ -16,7 +16,6 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Chat; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; -use RetailCrm\Mg\Bot\Model\Entity\CommonFields; /** * PHP version 7.0 @@ -30,7 +29,30 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields; */ class ChatMember { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + * @SkipWhenEmpty() + */ + private $updatedAt; /** * @var int $chatId @@ -68,6 +90,54 @@ class ChatMember */ private $state; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return int */ diff --git a/src/Bot/Model/Entity/Command.php b/src/Bot/Model/Entity/Command.php index df287f7..7a2624a 100644 --- a/src/Bot/Model/Entity/Command.php +++ b/src/Bot/Model/Entity/Command.php @@ -29,7 +29,30 @@ use JMS\Serializer\Annotation\Type; */ class Command { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + * @SkipWhenEmpty() + */ + private $updatedAt; /** * @var string $name @@ -49,6 +72,54 @@ class Command */ private $description; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return string */ diff --git a/src/Bot/Model/Entity/CommonFields.php b/src/Bot/Model/Entity/CommonFields.php deleted file mode 100644 index 49736c9..0000000 --- a/src/Bot/Model/Entity/CommonFields.php +++ /dev/null @@ -1,107 +0,0 @@ - - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers - */ - -namespace RetailCrm\Mg\Bot\Model\Entity; - -use JMS\Serializer\Annotation\Accessor; -use JMS\Serializer\Annotation\SkipWhenEmpty; -use JMS\Serializer\Annotation\Type; -use Symfony\Component\Validator\Constraints\Date; - -/** - * PHP version 7.0 - * - * CommonFields trait - * - * @package RetailCrm\Mg\Bot\Model\Entity - * @author retailCRM - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers - */ -trait CommonFields -{ - /** - * @var string $id - * - * @Type("string") - * @Accessor(getter="getId",setter="setId") - * @SkipWhenEmpty() - */ - private $id; - - /** - * @var \DateTime $createdAt - * - * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") - * @Accessor(getter="getCreatedAt",setter="setCreatedAt") - * @SkipWhenEmpty() - */ - private $createdAt; - - /** - * @var \DateTime $updatedAt - * - * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") - * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") - * @SkipWhenEmpty() - */ - private $updatedAt; - - /** - * @return string - */ - public function getId(): string - { - return $this->id; - } - - /** - * @param string $id - */ - public function setId(string $id) - { - $this->id = $id; - } - - /** - * @return \DateTime - */ - public function getCreatedAt(): \DateTime - { - return $this->createdAt; - } - - /** - * @param \DateTime $createdAt - */ - public function setCreatedAt(\DateTime $createdAt) - { - $this->createdAt = $createdAt; - } - - /** - * @return \DateTime - */ - public function getUpdatedAt(): \DateTime - { - return $this->updatedAt; - } - - /** - * @param \DateTime $updatedAt - */ - public function setUpdatedAt(\DateTime $updatedAt) - { - $this->updatedAt = $updatedAt; - } -} diff --git a/src/Bot/Model/Entity/Customer.php b/src/Bot/Model/Entity/Customer.php index 279300f..65560f4 100644 --- a/src/Bot/Model/Entity/Customer.php +++ b/src/Bot/Model/Entity/Customer.php @@ -31,7 +31,30 @@ use JMS\Serializer\Annotation\Type; */ class Customer { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + * @SkipWhenEmpty() + */ + private $updatedAt; /** * @var string $externalId @@ -152,6 +175,54 @@ class Customer */ private $email; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return string */ diff --git a/src/Bot/Model/Entity/Dialog.php b/src/Bot/Model/Entity/Dialog.php index 0116c8f..c4cc98e 100644 --- a/src/Bot/Model/Entity/Dialog.php +++ b/src/Bot/Model/Entity/Dialog.php @@ -29,7 +29,30 @@ use JMS\Serializer\Annotation\Type; */ class Dialog { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + * @SkipWhenEmpty() + */ + private $updatedAt; /** * @var int $botId @@ -103,6 +126,54 @@ class Dialog */ private $isActive; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return int */ diff --git a/src/Bot/Model/Entity/Message/Message.php b/src/Bot/Model/Entity/Message/Message.php index a13c13c..3fd5408 100644 --- a/src/Bot/Model/Entity/Message/Message.php +++ b/src/Bot/Model/Entity/Message/Message.php @@ -13,7 +13,6 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Message; -use RetailCrm\Mg\Bot\Model\Entity\CommonFields; use RetailCrm\Mg\Bot\Model\Entity\Dialog; use RetailCrm\Mg\Bot\Model\Entity\User; use JMS\Serializer\Annotation\Accessor; @@ -32,7 +31,30 @@ use JMS\Serializer\Annotation\Type; */ class Message { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + * @SkipWhenEmpty() + */ + private $updatedAt; /** * @var string $actions @@ -187,6 +209,54 @@ class Message */ private $product; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return string */ diff --git a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php index 357a032..9316da6 100644 --- a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php +++ b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php @@ -16,7 +16,6 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Message; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; -use RetailCrm\Mg\Bot\Model\Entity\CommonFields; /** * PHP version 7.0 @@ -30,8 +29,6 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields; */ class MessageOrderPaymentStatus { - use CommonFields; - /** * @var string $name * @@ -69,7 +66,7 @@ class MessageOrderPaymentStatus /** * @return bool */ - public function isPayed(): bool + public function getPayed(): bool { return $this->payed; } diff --git a/src/Bot/Model/Entity/Message/MessageQuantity.php b/src/Bot/Model/Entity/Message/MessageQuantity.php index d03cbdc..1449e57 100644 --- a/src/Bot/Model/Entity/Message/MessageQuantity.php +++ b/src/Bot/Model/Entity/Message/MessageQuantity.php @@ -13,7 +13,6 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Message; -use RetailCrm\Mg\Bot\Model\Entity\CommonFields; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; @@ -30,8 +29,6 @@ use JMS\Serializer\Annotation\Type; */ class MessageQuantity { - use CommonFields; - /** * @var float $value * diff --git a/src/Bot/Model/Entity/User.php b/src/Bot/Model/Entity/User.php index 1a9d3d3..f590450 100644 --- a/src/Bot/Model/Entity/User.php +++ b/src/Bot/Model/Entity/User.php @@ -30,7 +30,30 @@ use JMS\Serializer\Annotation\Type; */ class User { - use CommonFields; + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + */ + private $id; + + /** + * @var \DateTime $createdAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getCreatedAt",setter="setCreatedAt") + */ + private $createdAt; + + /** + * @var \DateTime $updatedAt + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Accessor(getter="getUpdatedAt",setter="setUpdatedAt") + * @SkipWhenEmpty() + */ + private $updatedAt; /** * @var string $externalId @@ -126,6 +149,54 @@ class User */ private $revokedAt; + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + */ + public function setCreatedAt(\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt(): \DateTime + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + */ + public function setUpdatedAt(\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + /** * @return string */