posts = new ObjectStorage(); $this->createdAt = new \DateTime(); } static public function getTableName(): string { return 'user'; } static public function getRepositoryName(): ?string { return null; } static public function columnsMapping(): array { if (PHP_VERSION_ID > 80000) { return []; } return [ (new PrimaryKeyColumn())->bindProperty('id'), (new StringColumn())->bindProperty('firstname'), (new StringColumn())->bindProperty('lastname'), (new StringColumn())->bindProperty('email'), (new StringColumn())->bindProperty('password'), (new BoolColumn( 'is_active'))->bindProperty('active'), (new DateTimeColumn( 'created_at'))->bindProperty('createdAt'), (new OneToMany( PostTest::class, 'user'))->bindProperty('posts'), (new JoinColumn( 'last_post_id', PostTest::class, 'id', true, true, JoinColumn::SET_NULL))->bindProperty('lastPost'), ]; } public function getPrimaryKeyValue() : ?int { return $this->getId(); } public function getId(): ?int { return $this->id; } public function setId(?int $id): UserTest { $this->id = $id; return $this; } public function getFirstname(): ?string { return $this->firstname; } public function setFirstname(?string $firstname): UserTest { $this->firstname = $firstname; return $this; } public function getLastname(): ?string { return $this->lastname; } public function setLastname(?string $lastname): UserTest { $this->lastname = $lastname; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(?string $email): UserTest { $this->email = $email; return $this; } public function getPassword(): ?string { return $this->password; } public function setPassword(?string $password): UserTest { $this->password = $password; return $this; } public function isActive(): bool { return $this->active; } public function setActive(bool $active): UserTest { $this->active = $active; return $this; } public function getCreatedAt(): ?\DateTime { return $this->createdAt; } public function setCreatedAt(?\DateTime $createdAt): UserTest { $this->createdAt = $createdAt; return $this; } public function getPosts(): ObjectStorage { return $this->posts; } public function addPost(PostTest $post): UserTest { $this->posts->add($post); return $this; } public function getLastPost(): ?PostTest { return $this->lastPost; } public function setLastPost(?PostTest $lastPost): UserTest { $this->lastPost = $lastPost; return $this; } }