Beispiel #1
0
 /**
  * @param array $credentials
  * @return Identity|\Nette\Security\IIdentity
  * @throws \Nette\Security\AuthenticationException
  */
 public function authenticate(array $credentials)
 {
     if ($this->checkConnection->invoke()) {
         try {
             /** @var $user \CmsModule\Pages\Users\UserEntity */
             $user = $this->userRepository->createQueryBuilder('a')->join('a.loginProviders', 's')->where('s.type = :type AND s.uid = :uid')->setParameter('type', static::getType())->setParameter('uid', $this->getLoginProviderEntity()->getUid())->getQuery()->getSingleResult();
         } catch (\Doctrine\ORM\NoResultException $e) {
         }
         if (!isset($user) || !$user) {
             throw new AuthenticationException('User does not exist.', self::INVALID_CREDENTIAL);
         }
         return new Identity($user->getId(), $user->getRoles());
     }
 }
 public function __construct()
 {
     $this->entity = $this->getEntityName();
     if (is_null(self::$cache)) {
         self::$cache = new ShopCache();
     }
 }
Beispiel #3
0
 /**
  * Overridden to encode the password
  *
  * @param $obj
  */
 public function save($obj)
 {
     /** @var User $obj */
     if ($obj->getPlainPassword()) {
         $obj->password = $this->encodePassword($obj, $obj->getPlainPassword());
     }
     parent::save($obj);
 }
Beispiel #4
0
 /**
  * Returns the URL to this category
  * for the frontend product browsing (filtered by category)
  *
  * TODO Remove this function and use the CategoryTreeNode features instead
  * because custom urls are already supported
  *
  * @param bool $relative
  * @return string
  */
 public function getUrl($relative = TRUE)
 {
     if (!$this->friendly_url) {
         return getUrl('', 'act', 'dispShop', 'vid', BaseRepository::vid(), 'category_srl', $this->category_srl);
     }
     $repo = $this->repo;
     return $repo::getUrl($this->friendly_url, $relative);
 }
 /**
  * Add repository specific logic to the insert action
  *
  * @param mixed $connection The database connection object
  * @return QubitRepository self-reference
  */
 protected function insert($connection = null)
 {
     // When creating a new repository, set the upload_limit to the default
     // value (app_repository_quota)
     if (null == $this->__get('uploadLimit')) {
         $this->__set('uploadLimit', sfConfig::get('app_repository_quota'));
     }
     parent::insert($connection);
     return $this;
 }
 private static function formater($datas, $single = false)
 {
     $lessonRegisterRepository = new LessonRegisterRepository();
     if ($single) {
         $datas['peoples'] = $lessonRegisterRepository->countByProperty('lesson_id', $datas['id']);
     } else {
         foreach ($datas as $dk => $dv) {
             $datas[$dk]['peoples'] = $lessonRegisterRepository->countByProperty('lesson_id', $dv['id']);
         }
     }
     $datas = parent::format($datas);
     return $datas;
 }
Beispiel #7
0
 /**
  * Checks if object is new or exists already in the database
  *
  * @return bool
  */
 public function isPersisted($checkDB = false)
 {
     $srl = $this->getMeta('srl');
     if (!is_numeric($this->{$srl})) {
         return false;
     }
     if ($checkDB) {
         $object = $this->repo->get($this->{$srl});
         if (!$object) {
             return false;
         }
     }
     return true;
 }
 private static function formater($datas, $single = false)
 {
     $lessonRepository = new LessonRepository();
     $lessons = $lessonRepository->findAll();
     foreach ($datas as $dk => $dv) {
         foreach ($lessons as $lk => $lv) {
             if ($lv['id'] == $dv['lesson_id']) {
                 $datas[$dk]['lesson_name'] = $lv['name'];
                 $datas[$dk]['lesson'] = $lv;
             }
         }
     }
     $datas = parent::format($datas);
     return $datas;
 }
 public function page($key = null, $profileId = 0, $rows = 25, $page = 1, $order = 'add_time desc')
 {
     $conditions = array();
     if (is_numeric($profileId) && $profileId > 0) {
         $conditions['profile_id'] = array('eq', $profileId);
     }
     if (!empty($key)) {
         $conditions['_string'] = ' (name like "%' . $key . '%")  OR ( mobile like "%' . $key . '%") OR (tencent like "%' . $key . '%") ';
     }
     $startRow = $rows * ($page - 1);
     $count = $this->_repository->where($conditions)->count();
     $data = $this->_repository->where($conditions)->order($order)->limit($startRow, $rows)->select();
     if (empty($data)) {
         $data = array();
     }
     $data = parent::format($data);
     $result = array('total' => $count, 'rows' => $data);
     return $result;
 }
 public function __construct()
 {
     parent::__construct();
 }
Beispiel #11
0
 /**
  * FooterRepository constructor.
  * @param FooterMapper $mapper
  */
 public function __construct(FooterMapper $mapper)
 {
     parent::__construct($mapper);
     $this->mapper = $mapper;
 }
Beispiel #12
0
 /**
  * get product url
  * @param bool $relative
  * @return string
  */
 public function getUrl($relative = true)
 {
     if (!$this->friendly_url) {
         return getUrl('', 'act', 'dispShopProduct', 'vid', BaseRepository::vid(), 'product_srl', $this->product_srl);
     }
     $repo = $this->repo;
     return $repo::getUrl($this->friendly_url, $relative);
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->collection = static::DOCUMENT_TRANSACTION;
     parent::__construct();
 }
Beispiel #14
0
 /**
  * SearchRepository constructor.
  * @param SearchMapper $mapper
  */
 public function __construct(SearchMapper $mapper)
 {
     parent::__construct($mapper);
     $this->mapper = $mapper;
 }
Beispiel #15
0
 /**
  * ArticlesRepository constructor.
  * @param ArticlesMapper $mapper
  */
 public function __construct(ArticlesMapper $mapper)
 {
     parent::__construct($mapper);
     $this->mapper = $mapper;
 }
 public function __construct()
 {
     $this->table = static::TABLE_GAIN_LOSS;
     parent::__construct();
 }
Beispiel #17
0
 /**
  * GalleriesRepository constructor.
  * @param GalleriesMapper $mapper
  */
 public function __construct(GalleriesMapper $mapper)
 {
     parent::__construct($mapper);
     $this->mapper = $mapper;
 }
Beispiel #18
0
 /**
  * {@inheritdoc}
  */
 public function getPerPage()
 {
     return $this->perPage ?: parent::getPerPage();
 }
Beispiel #19
0
 public function reset()
 {
     parent::reset();
     $this->position = 1;
     $this->count = null;
 }
Beispiel #20
0
 /**
  * @cache  Using PHP.
  * @ensure Provider\ContentEntity
  */
 protected function findById($id)
 {
     return parent::findById($id);
 }
Beispiel #21
0
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     RepositoryPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new RepositoryPeer();
     }
     return self::$peer;
 }
Beispiel #22
0
 /**
  * CommentsRepository constructor.
  * @param CommentsMapper $mapper
  */
 public function __construct(CommentsMapper $mapper)
 {
     parent::__construct($mapper);
     $this->mapper = $mapper;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->collection = static::DOCUMENT_SECURITY;
     parent::__construct();
 }
Beispiel #24
0
 public static function getUrl($pattern = null, $relative = true)
 {
     return ($relative ? '' : getFullSiteUrl()) . Context::pathToUrl(_XE_PATH_) . BaseRepository::vid() . '/' . $pattern;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->collection = static::DOCUMENT_UNREALIZED;
     parent::__construct();
 }
 protected function getFromString()
 {
     $fromString = parent::getFromString();
     return $fromString . ' LEFT JOIN e.category c';
 }
Beispiel #27
0
 /**
  * PicturesRepository constructor.
  * @param PicturesMapper $mapper
  */
 public function __construct(PicturesMapper $mapper)
 {
     parent::__construct($mapper);
     $this->mapper = $mapper;
 }