Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating private function saveInventoryArticles from createAction #67

Closed
Dev-Int opened this issue Dec 15, 2016 · 0 comments
Closed

Creating private function saveInventoryArticles from createAction #67

Dev-Int opened this issue Dec 15, 2016 · 0 comments
Assignees

Comments

@Dev-Int
Copy link
Owner

Dev-Int commented Dec 15, 2016

Result of analysis:

 - Too Many Nested Blocks in Function Declaration 
    (It is a good practice to introduce a new function rather than to use more nested blocks).
 - And method length is 30 lines (20 allowed).

Code to move:

// Saving of the articles in the inventory
foreach ($articles as $article) {
    foreach ($article->getZoneStorages()->getSnapshot() as $zoneStorage) {
        $inventoryArticles = new InventoryArticles();
        $inventoryArticles->setArticle($article);
        $inventoryArticles->setInventory($inventory);
        $inventoryArticles->setQuantity($article->getQuantity());
        $inventoryArticles->setRealstock(0);
        $inventoryArticles->setUnitStorage($article->getUnitStorage());
        $inventoryArticles->setPrice($article->getPrice());
        $inventoryArticles->setZoneStorage($zoneStorage->getName());
        $etm->persist($inventoryArticles);
    }
}

Add the parameters for this code to work.

@Dev-Int Dev-Int added this to the Inventory Bundle milestone Dec 15, 2016
@Dev-Int Dev-Int self-assigned this Dec 15, 2016
@Dev-Int Dev-Int closed this as completed in 17ea5ba Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant