public static function addOptionPrice($params, $currentUser, $con) { $option = NotificationOptionQuery::create()->filterByType('price')->filterByRoleId($params->role)->count($con); if ($option != 0) { throw new \Exception('Jabatan sudah dimasukkan'); } $option = new NotificationOption(); $option->setType('price')->setRoleId($params->role)->save($con); $results['success'] = true; $results['data'] = 'yay'; return $results; }
/** * Exclude object from result * * @param ChildNotificationOption $notificationOption Object to remove from the list of results * * @return $this|ChildNotificationOptionQuery The current query, for fluid interface */ public function prune($notificationOption = null) { if ($notificationOption) { $this->addUsingAlias(NotificationOptionTableMap::COL_ID, $notificationOption->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Filter the query by a related \ORM\NotificationOption object * * @param \ORM\NotificationOption|ObjectCollection $notificationOption the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildRoleQuery The current query, for fluid interface */ public function filterByNotificationOption($notificationOption, $comparison = null) { if ($notificationOption instanceof \ORM\NotificationOption) { return $this->addUsingAlias(RoleTableMap::COL_ID, $notificationOption->getRoleId(), $comparison); } elseif ($notificationOption instanceof ObjectCollection) { return $this->useNotificationOptionQuery()->filterByPrimaryKeys($notificationOption->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByNotificationOption() only accepts arguments of type \\ORM\\NotificationOption or Collection'); } }
/** * @param ChildNotificationOption $notificationOption The ChildNotificationOption object to add. */ protected function doAddNotificationOption(ChildNotificationOption $notificationOption) { $this->collNotificationOptions[] = $notificationOption; $notificationOption->setRole($this); }