Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Follow best practises around data models #21

@ashsmith

Description

@ashsmith

We should follow best practises set out by Magento by using data models to access our blog posts.

I'm going to implement the following

  • Ashsmith\Blog\Api\Data\PostInterface (this already exists)
  • Ashsmith\Blog\Api\PostRepositoryInterface
  • Ashsmith\Blog\Model\PostRepository
  • Ashsmith\Blog\Model\Data\Post

Then modify Ashsmith\Blog\Model\Post so that it no longer uses the interface, and has the method getDataModel.

PostRepositoryInterface should define the following methods:

  • getById($postId)
  • getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
  • delete(\Ashsmith\Blog\Api\Data\PostInterface $post)
  • deleteById($postId)

Any reference to loading the collections, or the original Post model directly will be switched out for the PostRepository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions