public function getRawValue() { if ($this->primaryValue === null && $this->value === false && !$this->metadata->relationship->isMain) { $this->getEntity(); // init the value } return parent::getRawValue(); }