/** * Update user band. * @param $json * @return \Oak\MVC\JsonViewModel */ public function updateAction($json) { $bandDto = $this->convertJson($json); $userBand = $this->userBandRepository->find($bandDto->id); $this->bandHelper->populateUserBandWithDto($userBand, $bandDto); $band = $this->bandRepository->findByName($userBand->getName()); if ($band == null) { $band = $this->bandHelper->convertDtoToBand($bandDto); $this->bandRepository->persist($band); } $userBand->setBand($band); $this->userBandRepository->flush(); $resultDto = $this->bandHelper->convertUserBandToDto($userBand); return new JsonViewModel($resultDto, $this->jsonUtils); }
/** * @covers {className}::{origMethodName} * @todo Implement testGetId(). */ public function testGetId() { self::assertNotEmpty($this->bandRepository->findAll()); }