You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I'm still learning about interfaces and using the repository pattern in Laravel. My question is whether the controller should be calling a method on the repository that is not present on that repository's interface. For example, in the UserTricksController, we call getEditForm on the Trick repository (line 122):
$form = $this->trick->getEditForm($trick->id);
The getEditForm method is not present on the TrickRepositoryInterface, however, but it is on the TrickRepository.
The text was updated successfully, but these errors were encountered:
dabernathy89
changed the title
Question: functions implemented but not in interface
Question: function in repository but not in interface
Mar 17, 2014
IMO you should not doing that.
The obvious thing is that you can change TrickRepository to for example TrickJsonRepository which would implement TrickRepositoryInterface.
And you will get into troubles because you won't have any hint about needing to implement getEditForm.
You should:
add getEditForm to TrickRepositoryInterface
or delegate it to something else.. Like FormBuilder or whatever
So I'm still learning about interfaces and using the repository pattern in Laravel. My question is whether the controller should be calling a method on the repository that is not present on that repository's interface. For example, in the UserTricksController, we call getEditForm on the Trick repository (line 122):
The getEditForm method is not present on the TrickRepositoryInterface, however, but it is on the TrickRepository.
The text was updated successfully, but these errors were encountered: