| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace Test\PhpDevCommunity\PaperORM\Entity;
- use PhpDevCommunity\PaperORM\Entity\EntityInterface;
- use PhpDevCommunity\PaperORM\Entity\TableMetadataInterface;
- use PhpDevCommunity\PaperORM\Mapping\Column\StringColumn;
- use PhpDevCommunity\PaperORM\Mapping\Column\JoinColumn;
- use PhpDevCommunity\PaperORM\Mapping\Column\PrimaryKeyColumn;
- use PhpDevCommunity\PaperORM\Mapping\Entity;
- use Test\PhpDevCommunity\PaperORM\Repository\TagTestRepository;
- #[Entity(table : 'comment', repository : null)]
- class CommentTest implements EntityInterface, TableMetadataInterface
- {
- private ?int $id = null;
- private ?string $body = null;
- private ?PostTest $post = null;
- static public function getTableName(): string
- {
- return 'comment';
- }
- static public function getRepositoryName(): ?string
- {
- return null;
- }
- static public function columnsMapping(): array
- {
- return [
- (new PrimaryKeyColumn())->bindProperty('id'),
- (new StringColumn())->bindProperty('body'),
- (new JoinColumn('post_id', 'id', PostTest::class))->bindProperty('post'),
- ];
- }
- public function getPrimaryKeyValue() : ?int
- {
- return $this->getId();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getBody(): ?string
- {
- return $this->body;
- }
- public function setBody(?string $body): CommentTest
- {
- $this->body = $body;
- return $this;
- }
- public function getPost(): ?PostTest
- {
- return $this->post;
- }
- public function setPost(?PostTest $post): CommentTest
- {
- $this->post = $post;
- return $this;
- }
- }
|