GitHub PullRequestReviewCommentEvent at 2014-04-25 07:36:35
Repository: Sylius
Actor: pjedrzejewski
Payload: {"comment":{"url":"https://api.github.com/repos/Sylius/Sylius/pulls/comments/11985681","id":11985681,"diff_hunk":"@@ -34,26 +42,10 @@ public function updateState(GenericEvent $event)\n     {\n         $unit = $this->getInventoryUnit($event);\n \n-        $state = $event->getArgument('state');\n-\n-        $unit->setInventoryState($state);\n+        $transitionName = $event->getArgument('transition');\n \n-        switch ($state) {\n-            case $unit::STATE_BACKORDERED:\n-                $unit->setShippingState(ShipmentInterface::STATE_ONHOLD);\n-                break;\n-\n-            case $unit::STATE_SOLD:\n-                $unit->setShippingState(ShipmentInterface::STATE_READY);\n-                break;\n-\n-            case $unit::STATE_RETURNED:\n-                $unit->setShippingState(ShipmentInterface::STATE_RETURNED);\n-                break;\n-\n-            default:\n-                throw new \\InvalidArgumentException(sprintf('Unexpected inventory state \"%s\".', $state));\n-        }\n+        $this->factory->get($unit, 'sylius_inventory_unit')->apply($transitionName);\n+        $this->factory->get($unit, 'sylius_shipping_unit')->apply($transitionName);","path":"src/Sylius/Bundle/CoreBundle/EventListener/InventoryUnitListener.php","position":48,"original_position":48,"commit_id":"8ac41876b45d6c85e35c486a62db44b7ee3633c5","original_commit_id":"8ac41876b45d6c85e35c486a62db44b7ee3633c5","user":{"login":"pjedrzejewski","id":614970,"avatar_url":"https://avatars.githubusercontent.com/u/614970?","gravatar_id":"e24f58354606e3bfd03e661b6bcb2eaf","url":"https://api.github.com/users/pjedrzejewski","html_url":"https://github.com/pjedrzejewski","followers_url":"https://api.github.com/users/pjedrzejewski/followers","following_url":"https://api.github.com/users/pjedrzejewski/following{/other_user}","gists_url":"https://api.github.com/users/pjedrzejewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pjedrzejewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjedrzejewski/subscriptions","organizations_url":"https://api.github.com/users/pjedrzejewski/orgs","repos_url":"https://api.github.com/users/pjedrzejewski/repos","events_url":"https://api.github.com/users/pjedrzejewski/events{/privacy}","received_events_url":"https://api.github.com/users/pjedrzejewski/received_events","type":"User","site_admin":false},"body":"The interface name implemented by InventoryUnit is ``ShippingItemInterface``, I think we should change `sylius_shipping_unit` to `sylius_shipping_item`, what do you think?","created_at":"2014-04-25T07:36:35Z","updated_at":"2014-04-25T07:36:35Z","html_url":"https://github.com/Sylius/Sylius/pull/1426#discussion_r11985681","pull_request_url":"https://api.github.com/repos/Sylius/Sylius/pulls/1426","_links":{"self":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/comments/11985681"},"html":{"href":"https://github.com/Sylius/Sylius/pull/1426#discussion_r11985681"},"pull_request":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/1426"}}}}