class Profile {
private $country;
private $city;
private $sex;
private $age;
public function __construct(string $country, string $city, string $sex, int $age) {
$this->country = $country;
$this->city = $city;
$this->sex = $sex;
$this->age = $age;
}
public function getAge(): int {
return $this->age;
}
}
$profile = new Profile($_GET['country'], $_GET['city'], $_GET['sex'], $_GET['age']);
UsersGetById.php->run($profile)
$profile = new Profile();
$user = new User($profile);
$this->em->persist($user);
$this->em->flush();
$id = $user->getId();
$this->em->clear();
$user = $this->em->getRepository('App\Entity\User')->find($id);
dump($user, $user->getProfile());
Entity of type Entity\Profile is missing an assigned ID for field 'user'. The identifier generation strategy for this entity requires the ID field to be populated before EntityManager#persist() is called. If you want automatically generated identifiers instead you need to adjust the metadata mapping accordingly.
А по моему это скорее причина сменить IDE, разве нет?