當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserManagerInterface::deleteUser方法代碼示例

本文整理匯總了PHP中FOS\UserBundle\Model\UserManagerInterface::deleteUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserManagerInterface::deleteUser方法的具體用法?PHP UserManagerInterface::deleteUser怎麽用?PHP UserManagerInterface::deleteUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FOS\UserBundle\Model\UserManagerInterface的用法示例。


在下文中一共展示了UserManagerInterface::deleteUser方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deleteObject

 /**
  * Removes the given user object.
  *
  * @param DataEvent $event
  */
 public function deleteObject(DataEvent $event)
 {
     $object = $event->getData();
     if ($object instanceof UserInterface) {
         $this->userManager->deleteUser($object);
         $this->eventDispatcher->dispatch(Events::POST_DELETE, $event);
         $event->stopPropagation();
     }
 }
開發者ID:reminec,項目名稱:DunglasApiBundle,代碼行數:14,代碼來源:EventSubscriber.php

示例2: deteleAll

 public function deteleAll()
 {
     $users = $this->userManager->findUsers();
     foreach ($users as $user) {
         $this->userManager->deleteUser($user);
     }
 }
開發者ID:bixlabs,項目名稱:concepto-sises,代碼行數:7,代碼來源:UserManipulator.php

示例3: onKernelView

 /**
  * Persists, updates or delete data return by the controller if applicable.
  *
  * @param GetResponseForControllerResultEvent $event
  */
 public function onKernelView(GetResponseForControllerResultEvent $event)
 {
     $user = $event->getControllerResult();
     if (!$user instanceof UserInterface) {
         return;
     }
     switch ($event->getRequest()->getMethod()) {
         case Request::METHOD_POST:
         case Request::METHOD_PUT:
             $this->userManager->updateUser($user, false);
             break;
         case Request::METHOD_DELETE:
             $this->userManager->deleteUser($user);
             $event->setControllerResult(null);
             break;
     }
 }
開發者ID:ZeBigDuck,項目名稱:DunglasApiBundle,代碼行數:22,代碼來源:EventListener.php

示例4: delete

 /**
  * Removes the User from the database.
  *
  * @param \Hal\Resource $resource
  *
  * @throws NotFoundHttpException if no user with the given id could be found.
  *
  * @return void
  */
 public function delete(Resource $resource)
 {
     $data = $resource->toArray();
     $user = $this->userManager->findUserByUsername($data['username']);
     if (!$user) {
         $errorMessage = $this->translator->trans('error.user_not_found', array('%username%' => $data['username']));
         throw new NotFoundHttpException($errorMessage);
     }
     $this->userManager->deleteUser($user);
 }
開發者ID:ingewikkeld,項目名稱:rest-user-bundle,代碼行數:19,代碼來源:User.php

示例5: deleteFOSUser

 /**
  * Deletes an user from the FOSUser system
  * @param User $user
  */
 public function deleteFOSUser(User $user)
 {
     if ($user->getProvider()->getType() !== self::BUILTIN_PROVIDER) {
         return;
     }
     $FOSUser = $this->userManager->findUserByUsername($user->getUsername());
     if ($FOSUser !== null) {
         $this->userManager->deleteUser($FOSUser);
     }
 }
開發者ID:fulcrum3d,項目名稱:PartKeepr,代碼行數:14,代碼來源:UserService.php

示例6: testDeleteEntity

 /**
  * {@inheritdoc}
  *
  * @dataProvider propertyAccessorProvider
  */
 public function testDeleteEntity(array $data = [])
 {
     // Instantiate User
     $user = (new User())->setUsername($data['username'])->setFullname($data['fullname'])->setEmail($data['email'])->setRoles($data['roles'])->setPassword($data['plainPassword'])->setEnabled($data['enabled']);
     foreach ($data['jobs'] as $job) {
         // Is added two times to ensure the adder handles duplications and will add it only one time
         $user->addJob($job);
         $user->addJob($job);
         $this->doctrineManager->persist($job);
     }
     $this->doctrineManager->persist($user);
     $this->doctrineManager->flush();
     // Actual test
     $this->userManager->deleteUser($user);
     foreach ($data['jobs'] as $job) {
         /* @var Job $job */
         $this->assertFalse($job->getUsers()->contains($user), 'Expected $job instance to no longer have a reference to $user.');
     }
 }
開發者ID:EllynB,項目名稱:Incipio,代碼行數:24,代碼來源:UserTest.php

示例7: delete

 /**
  * @inheritdoc
  */
 public function delete(FOSUserInterface $user)
 {
     $this->FOSUserManager->deleteUser($user);
 }
開發者ID:viettut,項目名稱:todo,代碼行數:7,代碼來源:LecturerManager.php

示例8: delete

 /**
  * Deletes the given user.
  *
  * @param string $username
  */
 public function delete($username)
 {
     $user = $this->findUserByUsernameOrThrowException($username);
     $this->userManager->deleteUser($user);
 }
開發者ID:Jheengut,項目名稱:linuxcounter.new,代碼行數:10,代碼來源:UserManipulator.php

示例9: remove

 public function remove($entity)
 {
     $this->userManager->deleteUser($entity);
 }
開發者ID:Exanrus,項目名稱:crm-bundle,代碼行數:4,代碼來源:UserManager.php


注:本文中的FOS\UserBundle\Model\UserManagerInterface::deleteUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。