本文整理匯總了PHP中UserRepository::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserRepository::delete方法的具體用法?PHP UserRepository::delete怎麽用?PHP UserRepository::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserRepository
的用法示例。
在下文中一共展示了UserRepository::delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handleSave
public function handleSave(Form $form)
{
$values = $form->values;
if ($values['file']->isOk()) {
if ($values['cleanout']) {
foreach ($this->userRepository->findAll() as $user) {
$this->userRepository->delete($user);
}
}
/** @var FileUpload $file */
$file = $values['file'];
$data = file_get_contents($file->getTemporaryFile());
foreach (explode("\n", $data) as $row) {
if (!$row) {
continue;
}
$items = explode(',', $row);
if (!count($items)) {
continue;
}
try {
$user = new UserEntity(trim($items[0]));
} catch (InvalidArgumentException $e) {
$form->addError($e->getMessage());
}
$this->userRepository->save($user);
}
}
}
示例2: startup
protected function startup()
{
parent::startup();
if ($this->key) {
if (($user = $this->userRepository->findOneBy(array('userKey' => $this->key))) === NULL) {
throw new BadRequestException();
}
$this->userRepository->delete($user);
$this->flashMessage('Byl jste odhlášen z newsletteru.', 'success');
$this->redirect('this', array('key' => NULL));
}
}
示例3: userDelete
public function userDelete($userId, \UserRepository $userRepository)
{
$userRepository->delete($userId);
}