This question has been on my mind for some time. I'm currently writing a repository with the usual methods: save, getById, getList, delete and deleteById. What is the correct return for each method?
Repository::save($dto)
- should the method return **$this**, **$dto** or (true || false)?
Repository::getById(int $id)
- for this one I'm pretty sure that it should return the corresponding DTO
Repository::getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
- should the method (always) return \Magento\Framework\Api\SearchResults $searchResult
Repository::delete($dto)
- should the method return **$this** or (true or false)?
Repository::deleteById(int $id)
- should the method return **$this** or (true or false)?