Пример #1
0
 protected function _readData($spec)
 {
     if (!is_numeric($spec)) {
         $spec = $this->getTable()->fetchRow($this->getTable()->select()->where("name = ?", $spec));
     }
     return parent::_readData($spec);
 }
Пример #2
0
 protected function _readData($spec)
 {
     if (is_scalar($spec)) {
         // Identity
         if (is_numeric($spec)) {
             // Can't use find because it won't return a row class
             $spec = $this->getTable()->fetchRow($this->getTable()->select()->where("user_id = ?", $spec));
         } else {
             if (is_string($spec) && strpos($spec, '@') !== false) {
                 $spec = $this->getTable()->fetchRow($this->getTable()->select()->where("email = ?", $spec));
             } else {
                 if (is_string($spec)) {
                     $spec = $this->getTable()->fetchRow($this->getTable()->select()->where("username = ?", $spec));
                 }
             }
         }
     }
     parent::_readData($spec);
 }