protected function setupState($state, $extra = null) { parent::setupState($state, $extra); if ($state->FirstTime) { $state->RelationVal = $this->onObject->{$this->relationName}()->ID; } }