where('account', 1)->execute())->getId() === 0) { $profile = new Profile(); $profile->account = AccountMapper::get()->where('id', 1)->execute(); $profile->birthday = ($date = new \DateTime('now')); $id = ProfileMapper::create()->execute($profile); } $employee = new Employee($profile); $id = EmployeeMapper::create()->execute($employee); self::assertGreaterThan(0, $employee->getId()); self::assertEquals($id, $employee->getId()); $employeeR = EmployeeMapper::get()->where('id', $employee->getId())->execute(); self::assertEquals($employee->profile->getId(), $employeeR->profile->getId()); self::assertGreaterThan(0, EmployeeMapper::get()->with('profile')->where('profile/account', 1)->limit(1)->execute()->getId()); } }