本文整理汇总了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);
}