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

add PropertyMetadata owner of embeddable to Embeddable::onAttach (BC break!) #736

Merged
merged 1 commit into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Entity/Embeddable/Embeddable.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getRawValue(): array
}


public function onAttach(IEntity $entity): void
public function onAttach(IEntity $entity, PropertyMetadata $propertyMetadata): void
{
$this->parentEntity = $entity;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Embeddable/EmbeddableContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function setInjectedValue($value): bool

if ($value !== null) {
assert($value instanceof IEmbeddable);
$value->onAttach($this->entity);
$value->onAttach($this->entity, $this->metadata);
}

$this->value = $value;
Expand Down
3 changes: 2 additions & 1 deletion src/Entity/Embeddable/IEmbeddable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


use Nextras\Orm\Entity\IEntity;
use Nextras\Orm\Entity\Reflection\PropertyMetadata;


/**
Expand Down Expand Up @@ -45,5 +46,5 @@ public function getRawValue(): array;
* This is called after injecting embeddable into property wrapper.
* @internal
*/
public function onAttach(IEntity $entity): void;
public function onAttach(IEntity $entity, PropertyMetadata $propertyMetadata): void;
}
Loading