I'm in the early stages of working on an application that is using the Repository Pattern to provide a data access abstraction. This application will have some form of a simple REST API but I'm not sure how to approach this using repositories. To illustrate this, a typical (very simplified) example of a repository is something like this:
<?php
$repo = new PostRepository(); // this would be resolved from an IoC container
$post = $repo->getByEmail('foo@wherever.com');
or maybe a little less rigid, like this:
$post = $repo->getBy('first_name', 'Bob');
But the pattern doesn't seem suited to anything more complicated like, say, the query from this url:
http://ift.tt/1zfPOX7
It seems like to handle stuff like that (let alone any much more complicated queries that many APIs support) you would pretty much end up having to reimplement the underlying ORM, or create a very leaky abstraction, neither of which seems ideal. Am I going about this wrong?
Aucun commentaire:
Enregistrer un commentaire