Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeddables doesn´t support relationships #427

Closed
Ivorius opened this issue Jun 14, 2020 · 1 comment
Closed

Embeddables doesn´t support relationships #427

Ivorius opened this issue Jun 14, 2020 · 1 comment
Labels

Comments

@Ivorius
Copy link

Ivorius commented Jun 14, 2020

It can not be used relationship in embeddables because throw exception Nextras\Orm\NullValueException

Property ...\Order::$country is not nullable

/**
 * @property-read string|NULL $street
 * @property-read string|NULL $city
 * @property-read string|NULL $postCode
 * @property Country $country {default CZ} {m:1 Country, oneSided=true}
 */
class Address extends \Nextras\Orm\Entity\Embeddable\Embeddable
{
	public function __construct(string $street, string $city, string $postCode, Country $country)
	{
		parent::__construct([
			'street' => $street,
			'city' => $city,
			'postCode' => $postCode,
			'country' => $country,
		]);
	}
}

Mapping

		$conventions->setMapping('address->street', 'street');
		$conventions->setMapping('address->city', 'town');
		$conventions->setMapping('address->postCode', 'postcode');
		$conventions->setMapping('address->country', 'country_code');

Versions::

  • Database: MySQL 5.7
  • Orm: master
  • Dbal: master
@Ivorius Ivorius added the bug label Jun 14, 2020
@hrach hrach changed the title Embeddables doesn´t support collections. Embeddables doesn´t support relationships Jun 20, 2020
@hrach hrach added this to the v4.0 milestone Jun 21, 2020
@hrach
Copy link
Member

hrach commented Jun 21, 2020

In the end, this is not really not supported.
Please see for future enhancements and implementation: #430

@hrach hrach removed this from the v4.0 milestone Jun 21, 2020
@hrach hrach closed this as completed Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants