{"action":"closed","issue":{"url":"https://api.github.com/repos/pheryjs/phery/issues/26","labels_url":"https://api.github.com/repos/pheryjs/phery/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/pheryjs/phery/issues/26/comments","events_url":"https://api.github.com/repos/pheryjs/phery/issues/26/events","html_url":"https://github.com/pheryjs/phery/issues/26","id":95626024,"number":26,"title":"Chaining PheryResponses that do not have a selector using PheryResponses::add() results in empty response","user":{"login":"holtkamp","id":776405,"avatar_url":"https://avatars.githubusercontent.com/u/776405?v=3","gravatar_id":"","url":"https://api.github.com/users/holtkamp","html_url":"https://github.com/holtkamp","followers_url":"https://api.github.com/users/holtkamp/followers","following_url":"https://api.github.com/users/holtkamp/following{/other_user}","gists_url":"https://api.github.com/users/holtkamp/gists{/gist_id}","starred_url":"https://api.github.com/users/holtkamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holtkamp/subscriptions","organizations_url":"https://api.github.com/users/holtkamp/orgs","repos_url":"https://api.github.com/users/holtkamp/repos","events_url":"https://api.github.com/users/holtkamp/events{/privacy}","received_events_url":"https://api.github.com/users/holtkamp/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-17T09:57:01Z","updated_at":"2015-07-18T10:49:23Z","closed_at":"2015-07-18T10:49:23Z","body":"When using this approach to chain / stack responses easily in PHP:\r\n```php\r\n$response = PheryResponse::factory(); //Note that no selector is used\r\n$response->add(PheryResponse::factory('#element')->html('elementContentGoesHere');\r\n$response->add($this->processSomeStuffAndReturnAPheryResponse());\r\n```\r\nThe result is an empty object: ```{}``` when returned to the client.\r\n\r\nWhen using a dummy selector, it works though:\r\n\r\n```php\r\n$response = PheryResponse::factory(__FUNCTION__); //Note that a dummy selector is used\r\n$response->add(PheryResponse::factory('#element')->html('elementContentGoesHere');\r\n$response->add($this->processSomeStuffAndReturnAPheryResponse());\r\n```\r\n\r\nIt seems that a (last) selector had to be set for the ```PheryResponse::add()``` function to work properly. Is this intended? When removing the [check for a 'lastSelector' in ```PheryResponse::__call()```](https://github.com/pheryjs/phery/blob/fca4dd87f1b9409c3c52981482501b85b63bcfcf/src/Phery/PheryResponse.php#L1402), it works properly, but I can not oversee the implications of this for other functionality since the documentation of that function states:\r\n\r\n*\"To reach this magically called functions, the jquery() selector must be called prior to any jquery specific call\"*\r\n\r\nWhat is the rationale for this condition? No need to reach anything to add it, right?\r\n\r\n**PheryResponse::merge()**\r\nMerging does work when no selectors are involved, since it does not go 'through' the ```PheryResponse::__call()``` method, only the order is reverted, so I would prefer to use the ```PheryResponse::add()```, or am expecting the wrong behaviour here?\r\n\r\n```php\r\n$response = PheryResponse::factory();\r\n$response->merge(PheryResponse::factory('#element')->html('elementContentGoesHere');\r\n$response->merge($this->processSomeStuffAndReturnAPheryResponse());\r\n```"}}