コード例 #1
0
 public function load(ObjectManager $manager)
 {
     $ah1 = new AssistantHistory();
     $ah1->setUser($this->getReference('user-1'));
     $ah1->setSchool($this->getReference('school-1'));
     $ah1->setSemester($this->getReference('semester-1'));
     $ah1->setWorkdays(4);
     $ah1->setBolk('Bolk 2');
     $ah1->setDay("Onsdag");
     $manager->persist($ah1);
     $manager->flush();
     $this->addReference('ah-1', $ah1);
 }
コード例 #2
0
 public function testSetUser()
 {
     // new assistantHistory entity
     $assistantHistory = new AssistantHistory();
     // New user entity
     $user = new User();
     // Fill in some random data to the user entity
     $user->setFirstName("Per");
     $user->setLastName("Olsen");
     $user->setUsername("petjo");
     // Use the setUser method for assistantHistory
     $assistantHistory->setUser($user);
     // Assert the result
     $this->assertEquals("petjo", $assistantHistory->getUser()->getUsername());
 }