/** * Создаёт нового исполнителя с сохранением в mysql и мемкеш * * @param array &$ExecutorRepository объект репозитория исполнителя * @param string $login логин * @param string $fio ФИО * @param int $salary * @param string $password пароль исполнителя * * @return &array объект исполнителя */ function &create(array &$ExecutorRepository, $login, $fio, $salary, $password) { $Executor =& Executor\construct(); Executor\setId($Executor, Memcached\increment(getMemcached($ExecutorRepository), getLastExecutorIdKey())); Executor\setLogin($Executor, $login); Executor\setSalary($Executor, $salary); Executor\setFio($Executor, $fio); $passwordHash = Password\hash($password); createInMysql($ExecutorRepository, $Executor, $passwordHash); savePasswordHashToMemcached($ExecutorRepository, $Executor, $passwordHash); saveLoginToMemcached($ExecutorRepository, $login, Executor\getId($Executor)); return $Executor; }
/** * Создаёт нового заказчика с сохранением в mysql и мемкеш * * @param array &$CustomerRepository объект репозитория заказчика * @param string $login логин * @param string $fio ФИО * @param string $password пароль заказчика * * @return &array объект заказчика */ function &create(array &$CustomerRepository, $login, $fio, $password) { $Customer =& Customer\construct(); Customer\setId($Customer, Memcached\increment(getMemcached($CustomerRepository), getLastCustomerIdKey())); Customer\setLogin($Customer, $login); Customer\setFio($Customer, $fio); $passwordHash = Password\hash($password); saveToMemcached($CustomerRepository, $Customer); savePasswordHashToMemcached($CustomerRepository, $Customer, $passwordHash); createInMysql($CustomerRepository, $Customer, $passwordHash); return $Customer; }