public function load(ObjectManager $manager) { $users = array(array('firstname' => 'Adrien', 'lastname' => 'Manikon', 'initial' => 'AM')); foreach ($users as $userData) { $user = new User(); $user->setFirstname($userData['firstname']); $user->setLastname($userData['lastname']); $user->setInitial($userData['initial']); $manager->persist($user); } $manager->flush(); }
private function prepareDataForRender($mainCategories, $subCategories, $subsubcategories, $users) { $noneCategory = new Category(); $noneCategory->setName("Keine"); $noneCategory->setParent($noneCategory); $noneUser = new User(); $noneUser->setLastname("Keine"); array_unshift($mainCategories, $noneCategory); array_unshift($subsubcategories, $noneCategory); array_unshift($users, $noneUser); return array('maincategories' => $this->buildCategoriesForView($mainCategories, "", "checked"), 'subcategories' => $subCategories, 'subsubcategories' => $this->buildCategoriesForView($subsubcategories, "default-select", "selected"), 'users' => $users); }