コード例 #1
0
ファイル: EstimateManager.php プロジェクト: vlamug/fambad
 /**
  * @param Estimate $estimate
  * @param AuthUser $user
  *
  * @return Estimate|null
  */
 public function save(Estimate $estimate, AuthUser $user)
 {
     if (empty($estimate->getEstimateId())) {
         $estimate->setCreateUserId($user->getUserId());
         $family = $this->familyRepository->getFamilyByUserId($user->getUserId());
         $estimate->setFamilyId($family->getFamilyId());
     }
     $estimate->setIsClosed(false);
     $estimateId = $this->estimateRepository->save($estimate);
     if (!$estimateId) {
         return null;
     }
     return $this->estimateRepository->getEstimateById($estimateId);
 }
コード例 #2
0
ファイル: BudgetManager.php プロジェクト: vlamug/fambad
 /**
  * @param BudgetForm $budgetForm
  * @param AuthUser $user
  *
  * @return Budget|null
  */
 public function save(BudgetForm $budgetForm, AuthUser $user)
 {
     if (empty($budgetForm->getBudgetId())) {
         $budgetForm->setCreateUserId($user->getUserId());
         $family = $this->familyRepository->getFamilyByUserId($user->getUserId());
         $budgetForm->setFamilyId($family->getFamilyId());
     }
     $budgetForm->setIsClosed(false);
     $budgetId = $this->budgetRepository->save($budgetForm);
     if (!$budgetId) {
         return null;
     }
     return $this->budgetRepository->getBudgetById($budgetId);
 }
コード例 #3
0
ファイル: CategoryManager.php プロジェクト: vlamug/fambad
 /**
  * @param AuthUser $user
  * @param string $categoryName
  *
  * @return bool
  */
 public function add(AuthUser $user, $categoryName)
 {
     $family = $this->familyRepository->getFamilyByUserId($user->getUserId());
     return $this->categoryRepository->insert(['family_id', 'category_name'])->values([$family->getFamilyId(), $categoryName]);
 }