public function saveAssociated(EntityInterface $entity, array $options = [])
{
$targetEntity = $entity->get($this->property());
$strategy = $this->saveStrategy();
$isEmpty = in_array($targetEntity, [null, [], '', false], true);
if ($isEmpty && $entity->isNew()) {
return $entity;
}
if ($isEmpty) {
$targetEntity = [];
}
if ($strategy === self::SAVE_APPEND) {
return $this->_saveTarget($entity, $targetEntity, $options);
}
if ($this->replaceLinks($entity, $targetEntity, $options)) {
return $entity;
}
return false;
}