Conversation
| */ | ||
| private $customerType; | ||
|
|
||
| public function __construct() |
There was a problem hiding this comment.
в 8.1 не уверен слопает ли доктрина но можно уже так
public function __construct(
private State $state = new InitialState(),
) {
}
There was a problem hiding this comment.
Тут есть один вопрос, смотри у меня получается что идет как раз связка
`
/**
* @var Collection
*/
#[ORM\OneToMany(mappedBy: "customer", targetEntity: "Quiz")]
private Collection $quiz;
public function __construct()
{
$this->quiz = new ArrayCollection();
}
`
Но если я сделаю короткую инициализацию как я смогу тогда написать #[ORM\OneToMany(mappedBy: "customer", targetEntity: "Quiz")]
There was a problem hiding this comment.
В последних версиях должны были добавить возможность писать, проверь если взлетит то ок, нет то оставляй как есть )
public function __construct(
#[ORM\Column(type: 'string')]
private string $firstName,
...
) { }There was a problem hiding this comment.
Я написал такую вещь,
public function __construct( #[ORM\OneToMany(mappedBy: "quiz", targetEntity: "Question")] private ArrayCollection $questions, ) { }
Но получил вот такую ошибку при попытке добавить фикстуры:
Too few arguments to function App\Domain\Quiz\Entity\Quiz::__construct(), 0 passed in /srv/app/src/Infractructure/DataFixtures/QuizFixtures.php on line 23 and exactly 1 ex pected
Я поискал в гите в репизотории орм и нашел переписку об этом doctrine/orm#8430
Но правда, этот вопрос остался открытым.
There was a problem hiding this comment.
ок, оставляй как было - вроде закрыто doctrine/orm#8266 но либо не релизнулось либо еще в планах, четкого ответа нет - ссылки на эту ишью и она вроде вмержена
| /** | ||
| * @ORM\PrePersist | ||
| */ | ||
| public function setCreatedAtAutomatically() |
src/Domain/Quiz/Entity/Answer.php
Outdated
|
|
||
| use Doctrine\ORM\Mapping as ORM; | ||
|
|
||
| /** |
There was a problem hiding this comment.
т.к. используешь php 8 можно попробовать использовать атрибуты (большинство библиотек уже готовы)
Add code Review
No description provided.