当前位置: 首页>>代码示例>>PHP>>正文


PHP UserRepository::findAll方法代码示例

本文整理汇总了PHP中UserRepository::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::findAll方法的具体用法?PHP UserRepository::findAll怎么用?PHP UserRepository::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserRepository的用法示例。


在下文中一共展示了UserRepository::findAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
         }
     }
 }
开发者ID:venne,项目名称:newsletter-module,代码行数:29,代码来源:ImportFormFactory.php

示例2: handleExport

 public function handleExport()
 {
     $ret = array();
     foreach ($this->repository->findAll() as $user) {
         $ret[] = array($user->email, $user->userKey);
     }
     $out = "";
     foreach ($ret as $arr) {
         $out .= implode(',', $arr) . "\n";
     }
     header('Content-Type: application/csv, utf-8');
     header('Content-Disposition: attachment;filename="users.csv"');
     header('Cache-Control: max-age=0');
     $this->presenter->sendResponse(new TextResponse($out));
 }
开发者ID:venne,项目名称:newsletter-module,代码行数:15,代码来源:UserTableControl.php

示例3: sendNewsletter

 /**
  * @param MessageEntity $messageEntity
  * @return int
  */
 public function sendNewsletter(MessageEntity $messageEntity)
 {
     $newsletter = $messageEntity->newsletter;
     /** @var NewsletterPresenter $presenter */
     $presenter = $this->application->getPresenterFactory()->createPresenter('Vranovsko:Pages:Newsletter:Newsletter');
     $presenter->autoCanonicalize = FALSE;
     /** @var Message $message */
     $message = $this->mailFactory->invoke();
     $message->setSubject($newsletter->getSubject());
     $x = 0;
     foreach ($messageEntity->getAllUsers() ? $this->userRepository->findAll() : $messageEntity->users as $user) {
         $presenter->setMessageUser($user);
         $request = new \Nette\Application\Request('Vranovsko:Pages:Newsletter:Newsletter', 'GET', array('routeId' => $newsletter->route->id));
         $response = $presenter->run($request);
         $html = (string) $response->getSource();
         $userMessage = clone $message;
         $userMessage->addTo($user->email);
         $userMessage->setHtmlBody($html, FALSE);
         $userMessage->send();
         $x++;
     }
     return $x;
 }
开发者ID:venne,项目名称:newsletter-module,代码行数:27,代码来源:NewsletterManager.php

示例4: getUsers

 /**
  * @return array
  */
 public function getUsers()
 {
     return $this->repository->findAll();
 }
开发者ID:cobase,项目名称:cobase,代码行数:7,代码来源:UserService.php


注:本文中的UserRepository::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。