";var_dump($employee); echo ""; $i++; } curl_close($curl); $this->employeesArray = $employeesArray; return true; } public function createAccount() { foreach ($this->employeesArray as $user) { $accountsEntity = new Accounts(); $accountsEntity->id = $user['id']; $accountsEntity->name = $user['name']; $accountsEntity->cmdlevel = 1; $accountsEntity->phone = '+7(916)9254713'; $accountsEntity->password = md5('123'); $accountsEntity->login = 'login'.rand(0,999); $accountsEntity->company_id = $this->company_id; if($accountsEntity->save()){ $accountsJobtypesEntity = new AccountsJobtypes(); $accountsJobtypesEntity->accounts_id = $accountsEntity->id; $accountsJobtypesEntity->jobtypes_id = 64; $accountsJobtypesEntity->save(); } else { return false; } } return true; } }