Nextras\Orm\Relationships\HasOne::isChanged PHP Метод

isChanged() защищенный Метод

protected isChanged ( $newValue )
    protected function isChanged($newValue)
    {
        // newValue is IEntity or null
        if ($this->value instanceof IEntity && $newValue instanceof IEntity) {
            return $this->value !== $newValue;
        } elseif ($this->value instanceof IEntity) {
            // value is some entity
            // newValue is null
            return true;
        } elseif ($newValue instanceof IEntity && $newValue->isPersisted()) {
            // value is persited entity or null
            // newValue is persisted entity
            return (string) $this->getPrimaryValue() !== (string) $newValue->getValue('id');
        } else {
            // value is persisted entity or null
            // newValue is null
            return $this->getPrimaryValue() !== $newValue;
        }
    }