From all the tutorials I've read the service layer only seems to only have one or two methods in it so I am unsure whether services are only supposed to be lightweight/skinny as opposed to fat with as many methods as you need
If I have a Post
domain object and have a PostService
class is this what you are ment to do from within a controller if you wanted to delete a post:
$postService = $this->serviceFactory->build('post');
$postService->deletePost($id);
and the deletePost()
method inside the PostService
is something like:
$postMapper = $this->dataMapperFactory->build('post');
$post = $postMapper->fetchById($id);
// Check if the post exists
// Check if it belongs to this user
// Some other checks
$postMapper->delete($post);
Is that correct? Essentially are domain objects just value objects and all the work gets done in the service layers?
Any help would be great thanks.