Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ORM\Entity
- */
- class FooBar
- {
- /** @ORM\Id @ORM\Column(type="integer", nullable=false) @ORM\GeneratedValue **/
- private ?int $id;
- /** @ORM\Column(type="string", nullable=false) */
- private string $foobar;
- public function __construct(string $foobar)
- {
- $this->foobar = $foobar;
- }
- public function getFoobar()
- {
- if ($this->foobar === null){
- throw new \LogicException('Foobar should not be retrieved before being hydrated.');
- }
- return $this->foobar;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement