public function load(ObjectManager $em) { $group1 = new TestGroup(); $group1->setName("Group 1"); $em->persist($group1); $group2 = new TestGroup(); $group2->setName("Group 2"); $em->persist($group2); $group3 = new TestGroup(); $group3->setName("Group 3 - Empty"); $em->persist($group3); $this->addReference('group-1', $group1); $this->addReference('group-2', $group2); $this->addReference('group-3', $group3); $em->flush(); }
private function getMockTest($userInGroup = TRUE) { $group = new TestGroup(); $group->setName("MemeGroup1"); $test = $this->getMock('Overwatch\\TestBundle\\Entity\\Test', ['getGroup']); $test->method('getGroup')->willReturn($group); if ($userInGroup === TRUE) { $group->addUser($this->user); } return $test; }
/** * Updates the given group * * @Route("/{id}") * @Method({"PUT"}) * @Security("has_role('ROLE_SUPER_ADMIN')") * @ApiDoc( * parameters={ * {"name"="name", "description"="A user-friendly name for the group", "required"=false, "format"="Group 1", "dataType"="string"} * }, * requirements={ * {"name"="id", "description"="The ID of the group to edit", "dataType"="integer", "requirement"="\d+"} * }, * tags={ * "Super Admin" = "#ff1919" * } * ) */ public function updateGroup(Request $request, TestGroup $group) { if ($request->request->has("name")) { $group->setName($request->request->get("name")); $this->_em->flush(); } return new JsonResponse($group); }