/** * @param Account $account * @param bool $andFlush * @todo need remove this method after task CRM-272 will done */ public function generate(Account $account, $andFlush = false) { $channel = new Channel(); $channel->setAccount($account); $channel->setName('Привлечение'); $dealState = new DealState(); $dealState->setName('Звонок'); $dealState->setAccount($account); $dealState->setIcon('fa fa-phone'); $this->em->persist($channel); $this->em->persist($dealState); if ($andFlush) { $this->em->flush(); } }
/** * @ApiDoc( * section="Deal States", * description="Remove deal state", * filters={ * {"name"="token", "type"="text"} * }, * parameters={ * {"name"="acceptor", "dataType"="integer", "required"=1, "description"="setting id for switch deal to next state"} * } * ) * @Method("DELETE") * @Route("/deal-states/{id}") * @ParamConverter("dealState", converter="account.doctrine.orm") * @param DealState $dealState * @return Response */ public function removeAction(DealState $dealState) { $id = $this->getRequest()->get('acceptor'); $acceptor = $this->getDoctrine()->getRepository('CoreBundle:DealState')->find($id); if (!$acceptor instanceof DealStateInterface) { return new JsonResponse(array('acceptor' => $this->get('translator')->trans('errors.deal_state.not_found', array('%id%' => $id))), Response::HTTP_UNPROCESSABLE_ENTITY); } $dealState->setAcceptor($acceptor); $this->get('perfico_crm.deal_state_manager')->remove($dealState); return new Response(); }
/** * @return DealState */ public function create() { $dealState = new DealState(); $dealState->setAccount($this->getCurrentAccount()); return $dealState; }