I have added a Repository interface in my Api directory and it's implementation in located under Models directory.
I have setup the preference for the interface in etc/di.xml.
When I run bin/magento setup:di:compile the following error is thrown in the console.
Source class "\Namespace\Module\Model\PostInterface" for "Namespace\Module\Model\PostRepository" generation does not exist.
I have no idea why the system is searching for "\Namespace\Module\Model\PostInterface" while I have mentioned clearly the location of the implementation class in di.xml.
Any suggestions are welcome with thanks !!
When I remove the Repository implementation file i.e; app/code/Namespace/Module/Model/PostRepository.php (imlpements app/code/Namespace/Module/Api/PostRepositoryInterface.php), the error disappears.
Also, when I rename the file from app/code/Namespace/Module/Model/PostRepository.php to app/code/Namespace/Module/Model/PostRepositoryy.php, the error disappears.
Is there any conventions that needs to be followed while using Repositories ?