X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fpq%2FMapper%2FStorageInterface.php;h=540d91f5dddfba58c43625dc0de4cfbd9506b37f;hb=refs%2Fheads%2Fmapper;hp=db16df52f7504f662e8b7e8117c7356d68ab2410;hpb=e6da4c7430e5c5b4ba482206e42aeebb4363d2b3;p=m6w6%2Fpq-gateway diff --git a/lib/pq/Mapper/StorageInterface.php b/lib/pq/Mapper/StorageInterface.php index db16df5..540d91f 100644 --- a/lib/pq/Mapper/StorageInterface.php +++ b/lib/pq/Mapper/StorageInterface.php @@ -5,11 +5,62 @@ namespace pq\Mapper; interface StorageInterface { /** - * @return pq\Mapper\Mapper + * Find by PK + * @param mixed $pk + * @return object */ - function getMapper(); + function get($pk); - function find($where, $order = null, $limit = null, $offset = null); + /** + * Find + * @param array $where + * @param string $order + * @param int $limit + * @param int $offset + * @return object[] + */ + function find($where = [], $order = null, $limit = null, $offset = null); + + /** + * Find parent + * @param object $object + * @param string $refName + * @return object + */ + function by($object, $refName); + + /** + * Find child rows + * @param object $object + * @param string $refName + * @return array + */ + function of($object, $refName); + + /** + * Delete + * @param object $object + */ function delete($object); - function persist($object); -} \ No newline at end of file + + /** + * Save + * @param object $object + */ + function save($object); + + /** + * Buffer in a transaction + */ + function buffer(); + + /** + * Commit + */ + function flush(); + + /** + * Rollback + */ + function discard(); +}