Пример #1
0
 /**
  * Dequeuet an URL
  *
  * @param string $name queue name, one of self::QUEUE_ constants
  *
  * @return string|null null if empty queue, else URL
  *
  * @throws \Exception if queue name is incorrect
  */
 public function get($name)
 {
     $this->checkName($name);
     // Get row with minimal id
     $row = ORM::for_table(self::TABLE)->select_many('id', 'url')->where('name', $name)->order_by_asc('id')->find_one();
     if (!$row) {
         return null;
     }
     // Store and remove for the DB
     $url = $row->url;
     $row->delete();
     return $url;
 }
Пример #2
0
 protected function initDB()
 {
     ORM::configure($this->config['db']);
 }
Пример #3
0
 /**
  * Wrap Idiorm's create method to return an
  * empty instance of the class associated with
  * this wrapper instead of the raw ORM class.
  *
  * @param mixed $data
  *
  * @return bool|Model
  */
 public function create($data = null)
 {
     return $this->_create_model_instance(parent::create($data));
 }
Пример #4
0
 /**
  * Get the database ID of this model instance.
  *
  * @return integer
  */
 public function id()
 {
     return $this->orm->id();
 }