コード例 #1
0
ファイル: SystemJobStore.php プロジェクト: dw250100785/Octo
 public function getNextJob()
 {
     $query = new Query('\\Octo\\System\\Model\\SystemJob');
     $query->select('*')->from('system_job')->order('run_date', 'ASC')->limit(1);
     if ($query->execute()) {
         $job = $query->fetch();
         if ($job->getRunDate() <= new \DateTime()) {
             return $job;
         }
     }
     return null;
 }
コード例 #2
0
ファイル: LogStore.php プロジェクト: dw250100785/Octo
 public function getLastEntry($scope)
 {
     $query = new Query($this->getNamespace('Log') . '\\Model\\Log', 'read');
     $query->select('*')->from('log')->limit(1);
     $query->where('scope = :scope');
     $query->bind(':scope', $scope);
     $query->order('id', 'DESC');
     try {
         $query->execute();
         return $query->fetch();
     } catch (PDOException $ex) {
         throw new StoreException('Could not get Log by Id', 0, $ex);
     }
 }
コード例 #3
0
 /**
  * @param $value
  * @param string $useConnection Connection type to use.
  * @throws StoreException
  * @return SystemJob
  */
 public function getById($value, $useConnection = 'read')
 {
     if (is_null($value)) {
         throw new StoreException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
     }
     $query = new Query($this->getNamespace('SystemJob') . '\\Model\\SystemJob', $useConnection);
     $query->select('*')->from('system_job')->limit(1);
     $query->where('`id` = :id');
     $query->bind(':id', $value);
     try {
         $query->execute();
         return $query->fetch();
     } catch (PDOException $ex) {
         throw new StoreException('Could not get SystemJob by Id', 0, $ex);
     }
 }
コード例 #4
0
ファイル: ContactStoreBase.php プロジェクト: dw250100785/Octo
 /**
  * @param $value
  * @param string $useConnection Connection type to use.
  * @throws StoreException
  * @return Contact
  */
 public function getByEmail($value, $useConnection = 'read')
 {
     if (is_null($value)) {
         throw new StoreException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
     }
     $query = new Query($this->getNamespace('Contact') . '\\Model\\Contact', $useConnection);
     $query->select('*')->from('contact')->limit(1);
     $query->where('`email` = :email');
     $query->bind(':email', $value);
     try {
         $query->execute();
         $result = $query->fetch();
         $this->setCache($value, $result);
         return $result;
     } catch (PDOException $ex) {
         throw new StoreException('Could not get Contact by Email', 0, $ex);
     }
 }
コード例 #5
0
 /**
  * @param $value
  * @param string $useConnection Connection type to use.
  * @throws StoreException
  * @return Permission
  */
 public function getById($value, $useConnection = 'read')
 {
     if (is_null($value)) {
         throw new StoreException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
     }
     // This is the primary key, so try and get from cache:
     $cacheResult = $this->getFromCache($value);
     if (!empty($cacheResult)) {
         return $cacheResult;
     }
     $query = new Query($this->getNamespace('Permission') . '\\Model\\Permission', $useConnection);
     $query->select('*')->from('permission')->limit(1);
     $query->where('`id` = :id');
     $query->bind(':id', $value);
     try {
         $query->execute();
         $result = $query->fetch();
         $this->setCache($value, $result);
         return $result;
     } catch (PDOException $ex) {
         throw new StoreException('Could not get Permission by Id', 0, $ex);
     }
 }