예제 #1
0
 public function saveWithParams(Article $article = null, User $user, array $data)
 {
     if (!$article) {
         $article = new Article();
         $article->setUser($user);
     }
     if (isset($data['name'])) {
         $article->setName($data['name']);
     }
     if (isset($data['code'])) {
         $article->setCode($data['code']);
     }
     if (isset($data['salesPrice'])) {
         $article->setSalesPrice($data['salesPrice']);
     }
     if (isset($data['qty'])) {
         $article->setQuantity($data['qty']);
     }
     if (isset($data['description'])) {
         $article->setDescription($data['description']);
     }
     if (isset($data['uom'])) {
         if ($data['uom'] > 0) {
             $uom = $this->settingsService->getUomById($data['uom']);
             $article->setUom($uom);
         }
     }
     return $this->saveArticle($article);
 }