I don't know how i can best solve this problem. I have a BaseBackEndController that implements basic functionality.
abstract class BaseBackEndController{
public function getOptionalValues(){}
protected function view($model = null, $viewName = null){}
protected function redirectToAction($action, $controller = null){}
public function getOptionalValues(){}
protected function addOptionalValue($key,$value){}
}
I wanted to add database functionality with a UnitofWork so i made a UnitOfWorkBackEndController that uses a implementation of a UnitOfWork to handle database functionality.
abstract class UoWBackEndController extends BaseBackEndController{
function __construct(IUnitOfWork $uow){}
protected function getSessionUser(){}
private function retrieveUserFromSession(){}
}
Then i also wanted to get access to the user that is logged in so i wanted some kind of way to access this but then i was already kinda suspicious when i made a class called UoWWithUserSessionBackEndController.
Now if i want to acces the session i need to give a UoW implementation and thats not what i want. I don't really know how to solve this so that it makes sense.
abstract class UoWWithUserSessionBackEndController extends UoWBackEndController{
function __construct(IUnitOfWork $uow) {
parent::__construct($uow);
// retrieve user from session and set it in the field
$this->_userInSession = $this->retrieveUserFromSession();
}
protected function getSessionUser(){}
private function retrieveUserFromSession(){}
}
or
abstract class UoWWithUserSessionBackEndController extends UoWBackEndController{
function __construct(IUnitOfWork $uow, ISessionHelper $sessionHelper) {
parent::__construct($uow);
// retrieve user from session and set it in the field
$this->_sessionHelper = $sessionHelper;
}
protected function getSessionHelper(){}
}