src/Traits/ViewVarTrait.php
protected function _deriveViewValue(Event $event)
    {
        $key = $this->_action()->subjectEntityKey();

        return $event->getSubject()->{$key};
    }
protected function _deriveViewValue(Event $event)
    {
        $key = $this->_action()->subjectEntityKey();

        return $event->getSubject()->{$key};
    }
protected function _deriveViewValue ( Event $ event ) { $ key = $ this -> _action ( ) -> subjectEntityKey ( ) ; return $ event -> getSubject ( ) -> { $ key } ; }
Derive the viewVar value based on the scope of the action
as well as the Event being handled

@param \Cake\Event\Event $event Event
@return mixed
@throws Exception
Derive the viewVar value based on the scope of the action as well as the Event being handled