{"action":"created","issue":{"url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen/issues/7","repository_url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen","labels_url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen/issues/7/comments","events_url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen/issues/7/events","html_url":"https://github.com/rambler-digital-solutions/hydrogen/issues/7","id":379436015,"node_id":"MDU6SXNzdWUzNzk0MzYwMTU=","number":7,"title":"Add method next and prev from entity","user":{"login":"chiqui3d","id":2461400,"node_id":"MDQ6VXNlcjI0NjE0MDA=","avatar_url":"https://avatars3.githubusercontent.com/u/2461400?v=4","gravatar_id":"","url":"https://api.github.com/users/chiqui3d","html_url":"https://github.com/chiqui3d","followers_url":"https://api.github.com/users/chiqui3d/followers","following_url":"https://api.github.com/users/chiqui3d/following{/other_user}","gists_url":"https://api.github.com/users/chiqui3d/gists{/gist_id}","starred_url":"https://api.github.com/users/chiqui3d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chiqui3d/subscriptions","organizations_url":"https://api.github.com/users/chiqui3d/orgs","repos_url":"https://api.github.com/users/chiqui3d/repos","events_url":"https://api.github.com/users/chiqui3d/events{/privacy}","received_events_url":"https://api.github.com/users/chiqui3d/received_events","type":"User","site_admin":false},"labels":[{"id":943404348,"node_id":"MDU6TGFiZWw5NDM0MDQzNDg=","url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen/labels/Feature","name":"Feature","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":{"login":"SerafimArts","id":2461257,"node_id":"MDQ6VXNlcjI0NjEyNTc=","avatar_url":"https://avatars2.githubusercontent.com/u/2461257?v=4","gravatar_id":"","url":"https://api.github.com/users/SerafimArts","html_url":"https://github.com/SerafimArts","followers_url":"https://api.github.com/users/SerafimArts/followers","following_url":"https://api.github.com/users/SerafimArts/following{/other_user}","gists_url":"https://api.github.com/users/SerafimArts/gists{/gist_id}","starred_url":"https://api.github.com/users/SerafimArts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SerafimArts/subscriptions","organizations_url":"https://api.github.com/users/SerafimArts/orgs","repos_url":"https://api.github.com/users/SerafimArts/repos","events_url":"https://api.github.com/users/SerafimArts/events{/privacy}","received_events_url":"https://api.github.com/users/SerafimArts/received_events","type":"User","site_admin":false},"assignees":[{"login":"SerafimArts","id":2461257,"node_id":"MDQ6VXNlcjI0NjEyNTc=","avatar_url":"https://avatars2.githubusercontent.com/u/2461257?v=4","gravatar_id":"","url":"https://api.github.com/users/SerafimArts","html_url":"https://github.com/SerafimArts","followers_url":"https://api.github.com/users/SerafimArts/followers","following_url":"https://api.github.com/users/SerafimArts/following{/other_user}","gists_url":"https://api.github.com/users/SerafimArts/gists{/gist_id}","starred_url":"https://api.github.com/users/SerafimArts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SerafimArts/subscriptions","organizations_url":"https://api.github.com/users/SerafimArts/orgs","repos_url":"https://api.github.com/users/SerafimArts/repos","events_url":"https://api.github.com/users/SerafimArts/events{/privacy}","received_events_url":"https://api.github.com/users/SerafimArts/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-11-10T16:24:42Z","updated_at":"2018-11-14T11:40:08Z","closed_at":null,"author_association":"NONE","body":"- Hydrogen Version: (e.g. dev-master)\r\n- PHP Version: (e.g. 7.1)\r\n\r\n### Description:\r\nIt would be possible to add the methods \"next\" and \"prev\", based on a result of an entity, that way for example in a blog easily get the previous and next article, and the same for the next and prev meta tags.\r\n\r\nthanks"},"comment":{"url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen/issues/comments/438633566","html_url":"https://github.com/rambler-digital-solutions/hydrogen/issues/7#issuecomment-438633566","issue_url":"https://api.github.com/repos/rambler-digital-solutions/hydrogen/issues/7","id":438633566,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODYzMzU2Ng==","user":{"login":"SerafimArts","id":2461257,"node_id":"MDQ6VXNlcjI0NjEyNTc=","avatar_url":"https://avatars2.githubusercontent.com/u/2461257?v=4","gravatar_id":"","url":"https://api.github.com/users/SerafimArts","html_url":"https://github.com/SerafimArts","followers_url":"https://api.github.com/users/SerafimArts/followers","following_url":"https://api.github.com/users/SerafimArts/following{/other_user}","gists_url":"https://api.github.com/users/SerafimArts/gists{/gist_id}","starred_url":"https://api.github.com/users/SerafimArts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SerafimArts/subscriptions","organizations_url":"https://api.github.com/users/SerafimArts/orgs","repos_url":"https://api.github.com/users/SerafimArts/repos","events_url":"https://api.github.com/users/SerafimArts/events{/privacy}","received_events_url":"https://api.github.com/users/SerafimArts/received_events","type":"User","site_admin":false},"created_at":"2018-11-14T11:40:08Z","updated_at":"2018-11-14T11:40:08Z","author_association":"MEMBER","body":"> Very good idea, I understand the concept, but I use Symfony with no Laravel, anyway thank you very much\r\n\r\nThis example is framework-agnostic. On a Ыньащтн, it will work the same way. The `macro()` support is implemented inside `Query` to expand its capabilities.\r\n\r\n> Also some idea of using it without macros ?\r\n\r\nUsing scopes (https://github.com/rambler-digital-solutions/hydrogen#query-scopes) like this:\r\n\r\n```php\r\ninterface CursorInterface\r\n{\r\n   public function current(): object;\r\n   public function next(): ?object;\r\n   public function prev(): ?object;\r\n}\r\n\r\nclass MyRepository extends EntityRepository\r\n{\r\n    use Hydrogen;\r\n    \r\n    public function cursor(int $id): CursorInterface\r\n    {\r\n        $key = \\array_first($this->getClassMetadata()->getIdentifier());\r\n\r\n        $query = $this;\r\n\r\n        $result = $query->clone()->where($key, $id)->take(1)->first();\r\n\r\n        return new MyExampleCursor($query, $result, $id, $key);\r\n    }\r\n}\r\n\r\n\r\n$cursor = $repo->cursor(42);\r\ndump($cursor->current());\r\ndump($cursor->next());\r\ndump($cursor->prev());\r\n```\r\n\r\nIt can be implemented as a trait, for example"}}
{"actor":{"display_login":"SerafimArts"}}