{"action":"created","comment":{"url":"https://api.github.com/repos/nelmio/alice/pulls/comments/63252226","id":63252226,"diff_hunk":"@@ -0,0 +1,78 @@\n+<?php\n+\n+namespace Nelmio\\Alice\\Fixtures\\Builder\\Methods;\n+\n+use Nelmio\\Alice\\Fixtures\\Fixture;\n+use Nelmio\\Alice\\Instances\\Collection;\n+\n+final class ReferenceRangeName implements MethodInterface\n+{\n+    /**\n+     * @var array $matches\n+     */\n+    private $matches = [];\n+\n+    /**\n+     * @var \\Nelmio\\Alice\\Instances\\Collection\n+     */\n+    private $objects;\n+\n+    /**\n+     * @param \\Nelmio\\Alice\\Instances\\Collection $objects\n+     */\n+    public function __construct(Collection $objects)\n+    {\n+        $this->objects = $objects;\n+    }\n+\n+    /**\n+     * {@inheritDoc}\n+     */\n+    public function canBuild($name)\n+    {\n+        return 1 === preg_match('#\\{@([0-9a-zA-Z\\._\\-]+)(\\*?+)\\}#i', $name, $this->matches);\n+    }\n+\n+    /**\n+     * {@inheritDoc}\n+     */\n+    public function build($class, $name, array $spec)\n+    {\n+        $fixtures = [];\n+\n+        // could be 'car1' from engine_{@car1}\n+        $referenceName = $this->matches[1];\n+        $referenceAll = '*' === $this->matches[2];\n+\n+        if ($referenceAll) {\n+            $keys = $this->objects->getKeysByMask($referenceName.\".+\");\n+\n+            if (count($keys) === 0) {","path":"src/Nelmio/Alice/Fixtures/Builder/Methods/ReferenceRangeName.php","position":50,"original_position":50,"commit_id":"e27c8a320424988e88874a6e70e3dd22b404b883","original_commit_id":"e27c8a320424988e88874a6e70e3dd22b404b883","user":{"login":"theofidry","id":5175937,"avatar_url":"https://avatars.githubusercontent.com/u/5175937?v=3","gravatar_id":"","url":"https://api.github.com/users/theofidry","html_url":"https://github.com/theofidry","followers_url":"https://api.github.com/users/theofidry/followers","following_url":"https://api.github.com/users/theofidry/following{/other_user}","gists_url":"https://api.github.com/users/theofidry/gists{/gist_id}","starred_url":"https://api.github.com/users/theofidry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theofidry/subscriptions","organizations_url":"https://api.github.com/users/theofidry/orgs","repos_url":"https://api.github.com/users/theofidry/repos","events_url":"https://api.github.com/users/theofidry/events{/privacy}","received_events_url":"https://api.github.com/users/theofidry/received_events","type":"User","site_admin":false},"body":"yoda condition","created_at":"2016-05-13T21:16:13Z","updated_at":"2016-05-13T21:16:13Z","html_url":"https://github.com/nelmio/alice/pull/347#discussion_r63252226","pull_request_url":"https://api.github.com/repos/nelmio/alice/pulls/347","_links":{"self":{"href":"https://api.github.com/repos/nelmio/alice/pulls/comments/63252226"},"html":{"href":"https://github.com/nelmio/alice/pull/347#discussion_r63252226"},"pull_request":{"href":"https://api.github.com/repos/nelmio/alice/pulls/347"}}},"pull_request":{"url":"https://api.github.com/repos/nelmio/alice/pulls/347","id":70057495,"html_url":"https://github.com/nelmio/alice/pull/347","diff_url":"https://github.com/nelmio/alice/pull/347.diff","patch_url":"https://github.com/nelmio/alice/pull/347.patch","issue_url":"https://api.github.com/repos/nelmio/alice/issues/347","number":347,"state":"open","locked":false,"title":"add reference range name builder","user":{"login":"reinfi","id":9324423,"avatar_url":"https://avatars.githubusercontent.com/u/9324423?v=3","gravatar_id":"","url":"https://api.github.com/users/reinfi","html_url":"https://github.com/reinfi","followers_url":"https://api.github.com/users/reinfi/followers","following_url":"https://api.github.com/users/reinfi/following{/other_user}","gists_url":"https://api.github.com/users/reinfi/gists{/gist_id}","starred_url":"https://api.github.com/users/reinfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reinfi/subscriptions","organizations_url":"https://api.github.com/users/reinfi/orgs","repos_url":"https://api.github.com/users/reinfi/repos","events_url":"https://api.github.com/users/reinfi/events{/privacy}","received_events_url":"https://api.github.com/users/reinfi/received_events","type":"User","site_admin":false},"body":"This builder would help to create fixtures for OneToOne relations within doctrine or other ORMs.\r\n\r\nYou could reference objects created earlier in your fixtures to create the same amount of instances.\r\nYou're free to select just one object or the whole list matched by a mask. The builder then creates as many instances as matched by your mask.\r\n\r\nThe only condition is that your fixtures must be declared within different files.\r\n\r\nI saw this pull request #236. In a way it gives the opportunity to add own builders but in my case I need the object reference. Another idea could be to implemnent an ObjectsAwareInterface which sets the current objects to a builder if required.\r\n","created_at":"2016-05-13T20:59:49Z","updated_at":"2016-05-13T21:16:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42cd360b717034bbdae6fc47e5f47dc03328d0c5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nelmio/alice/pulls/347/commits","review_comments_url":"https://api.github.com/repos/nelmio/alice/pulls/347/comments","review_comment_url":"https://api.github.com/repos/nelmio/alice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nelmio/alice/issues/347/comments","statuses_url":"https://api.github.com/repos/nelmio/alice/statuses/e27c8a320424988e88874a6e70e3dd22b404b883","head":{"label":"reinfi:master","ref":"master","sha":"e27c8a320424988e88874a6e70e3dd22b404b883","user":{"login":"reinfi","id":9324423,"avatar_url":"https://avatars.githubusercontent.com/u/9324423?v=3","gravatar_id":"","url":"https://api.github.com/users/reinfi","html_url":"https://github.com/reinfi","followers_url":"https://api.github.com/users/reinfi/followers","following_url":"https://api.github.com/users/reinfi/following{/other_user}","gists_url":"https://api.github.com/users/reinfi/gists{/gist_id}","starred_url":"https://api.github.com/users/reinfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reinfi/subscriptions","organizations_url":"https://api.github.com/users/reinfi/orgs","repos_url":"https://api.github.com/users/reinfi/repos","events_url":"https://api.github.com/users/reinfi/events{/privacy}","received_events_url":"https://api.github.com/users/reinfi/received_events","type":"User","site_admin":false},"repo":{"id":52389682,"name":"alice","full_name":"reinfi/alice","owner":{"login":"reinfi","id":9324423,"avatar_url":"https://avatars.githubusercontent.com/u/9324423?v=3","gravatar_id":"","url":"https://api.github.com/users/reinfi","html_url":"https://github.com/reinfi","followers_url":"https://api.github.com/users/reinfi/followers","following_url":"https://api.github.com/users/reinfi/following{/other_user}","gists_url":"https://api.github.com/users/reinfi/gists{/gist_id}","starred_url":"https://api.github.com/users/reinfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reinfi/subscriptions","organizations_url":"https://api.github.com/users/reinfi/orgs","repos_url":"https://api.github.com/users/reinfi/repos","events_url":"https://api.github.com/users/reinfi/events{/privacy}","received_events_url":"https://api.github.com/users/reinfi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reinfi/alice","description":"Expressive fixtures generator","fork":true,"url":"https://api.github.com/repos/reinfi/alice","forks_url":"https://api.github.com/repos/reinfi/alice/forks","keys_url":"https://api.github.com/repos/reinfi/alice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reinfi/alice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reinfi/alice/teams","hooks_url":"https://api.github.com/repos/reinfi/alice/hooks","issue_events_url":"https://api.github.com/repos/reinfi/alice/issues/events{/number}","events_url":"https://api.github.com/repos/reinfi/alice/events","assignees_url":"https://api.github.com/repos/reinfi/alice/assignees{/user}","branches_url":"https://api.github.com/repos/reinfi/alice/branches{/branch}","tags_url":"https://api.github.com/repos/reinfi/alice/tags","blobs_url":"https://api.github.com/repos/reinfi/alice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reinfi/alice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reinfi/alice/git/refs{/sha}","trees_url":"https://api.github.com/repos/reinfi/alice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reinfi/alice/statuses/{sha}","languages_url":"https://api.github.com/repos/reinfi/alice/languages","stargazers_url":"https://api.github.com/repos/reinfi/alice/stargazers","contributors_url":"https://api.github.com/repos/reinfi/alice/contributors","subscribers_url":"https://api.github.com/repos/reinfi/alice/subscribers","subscription_url":"https://api.github.com/repos/reinfi/alice/subscription","commits_url":"https://api.github.com/repos/reinfi/alice/commits{/sha}","git_commits_url":"https://api.github.com/repos/reinfi/alice/git/commits{/sha}","comments_url":"https://api.github.com/repos/reinfi/alice/comments{/number}","issue_comment_url":"https://api.github.com/repos/reinfi/alice/issues/comments{/number}","contents_url":"https://api.github.com/repos/reinfi/alice/contents/{+path}","compare_url":"https://api.github.com/repos/reinfi/alice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reinfi/alice/merges","archive_url":"https://api.github.com/repos/reinfi/alice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reinfi/alice/downloads","issues_url":"https://api.github.com/repos/reinfi/alice/issues{/number}","pulls_url":"https://api.github.com/repos/reinfi/alice/pulls{/number}","milestones_url":"https://api.github.com/repos/reinfi/alice/milestones{/number}","notifications_url":"https://api.github.com/repos/reinfi/alice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reinfi/alice/labels{/name}","releases_url":"https://api.github.com/repos/reinfi/alice/releases{/id}","deployments_url":"https://api.github.com/repos/reinfi/alice/deployments","created_at":"2016-02-23T20:34:10Z","updated_at":"2016-02-23T20:34:11Z","pushed_at":"2016-05-13T20:56:37Z","git_url":"git://github.com/reinfi/alice.git","ssh_url":"git@github.com:reinfi/alice.git","clone_url":"https://github.com/reinfi/alice.git","svn_url":"https://github.com/reinfi/alice","homepage":null,"size":793,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nelmio:2.x","ref":"2.x","sha":"b17831bac49815fde33961687543c00ad7e6a7b8","user":{"login":"nelmio","id":460596,"avatar_url":"https://avatars.githubusercontent.com/u/460596?v=3","gravatar_id":"","url":"https://api.github.com/users/nelmio","html_url":"https://github.com/nelmio","followers_url":"https://api.github.com/users/nelmio/followers","following_url":"https://api.github.com/users/nelmio/following{/other_user}","gists_url":"https://api.github.com/users/nelmio/gists{/gist_id}","starred_url":"https://api.github.com/users/nelmio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nelmio/subscriptions","organizations_url":"https://api.github.com/users/nelmio/orgs","repos_url":"https://api.github.com/users/nelmio/repos","events_url":"https://api.github.com/users/nelmio/events{/privacy}","received_events_url":"https://api.github.com/users/nelmio/received_events","type":"Organization","site_admin":false},"repo":{"id":6416536,"name":"alice","full_name":"nelmio/alice","owner":{"login":"nelmio","id":460596,"avatar_url":"https://avatars.githubusercontent.com/u/460596?v=3","gravatar_id":"","url":"https://api.github.com/users/nelmio","html_url":"https://github.com/nelmio","followers_url":"https://api.github.com/users/nelmio/followers","following_url":"https://api.github.com/users/nelmio/following{/other_user}","gists_url":"https://api.github.com/users/nelmio/gists{/gist_id}","starred_url":"https://api.github.com/users/nelmio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nelmio/subscriptions","organizations_url":"https://api.github.com/users/nelmio/orgs","repos_url":"https://api.github.com/users/nelmio/repos","events_url":"https://api.github.com/users/nelmio/events{/privacy}","received_events_url":"https://api.github.com/users/nelmio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nelmio/alice","description":"Expressive fixtures generator","fork":false,"url":"https://api.github.com/repos/nelmio/alice","forks_url":"https://api.github.com/repos/nelmio/alice/forks","keys_url":"https://api.github.com/repos/nelmio/alice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nelmio/alice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nelmio/alice/teams","hooks_url":"https://api.github.com/repos/nelmio/alice/hooks","issue_events_url":"https://api.github.com/repos/nelmio/alice/issues/events{/number}","events_url":"https://api.github.com/repos/nelmio/alice/events","assignees_url":"https://api.github.com/repos/nelmio/alice/assignees{/user}","branches_url":"https://api.github.com/repos/nelmio/alice/branches{/branch}","tags_url":"https://api.github.com/repos/nelmio/alice/tags","blobs_url":"https://api.github.com/repos/nelmio/alice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nelmio/alice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nelmio/alice/git/refs{/sha}","trees_url":"https://api.github.com/repos/nelmio/alice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nelmio/alice/statuses/{sha}","languages_url":"https://api.github.com/repos/nelmio/alice/languages","stargazers_url":"https://api.github.com/repos/nelmio/alice/stargazers","contributors_url":"https://api.github.com/repos/nelmio/alice/contributors","subscribers_url":"https://api.github.com/repos/nelmio/alice/subscribers","subscription_url":"https://api.github.com/repos/nelmio/alice/subscription","commits_url":"https://api.github.com/repos/nelmio/alice/commits{/sha}","git_commits_url":"https://api.github.com/repos/nelmio/alice/git/commits{/sha}","comments_url":"https://api.github.com/repos/nelmio/alice/comments{/number}","issue_comment_url":"https://api.github.com/repos/nelmio/alice/issues/comments{/number}","contents_url":"https://api.github.com/repos/nelmio/alice/contents/{+path}","compare_url":"https://api.github.com/repos/nelmio/alice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nelmio/alice/merges","archive_url":"https://api.github.com/repos/nelmio/alice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nelmio/alice/downloads","issues_url":"https://api.github.com/repos/nelmio/alice/issues{/number}","pulls_url":"https://api.github.com/repos/nelmio/alice/pulls{/number}","milestones_url":"https://api.github.com/repos/nelmio/alice/milestones{/number}","notifications_url":"https://api.github.com/repos/nelmio/alice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nelmio/alice/labels{/name}","releases_url":"https://api.github.com/repos/nelmio/alice/releases{/id}","deployments_url":"https://api.github.com/repos/nelmio/alice/deployments","created_at":"2012-10-27T11:57:40Z","updated_at":"2016-05-12T09:20:34Z","pushed_at":"2016-05-13T20:59:50Z","git_url":"git://github.com/nelmio/alice.git","ssh_url":"git@github.com:nelmio/alice.git","clone_url":"https://github.com/nelmio/alice.git","svn_url":"https://github.com/nelmio/alice","homepage":null,"size":1224,"stargazers_count":1018,"watchers_count":1018,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":146,"mirror_url":null,"open_issues_count":57,"forks":146,"open_issues":57,"watchers":1018,"default_branch":"2.x"}},"_links":{"self":{"href":"https://api.github.com/repos/nelmio/alice/pulls/347"},"html":{"href":"https://github.com/nelmio/alice/pull/347"},"issue":{"href":"https://api.github.com/repos/nelmio/alice/issues/347"},"comments":{"href":"https://api.github.com/repos/nelmio/alice/issues/347/comments"},"review_comments":{"href":"https://api.github.com/repos/nelmio/alice/pulls/347/comments"},"review_comment":{"href":"https://api.github.com/repos/nelmio/alice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nelmio/alice/pulls/347/commits"},"statuses":{"href":"https://api.github.com/repos/nelmio/alice/statuses/e27c8a320424988e88874a6e70e3dd22b404b883"}}}}