Пример #1
0
 /**
  * Get the models primary key.
  *
  * @return mixed
  */
 public function getId()
 {
     if (null === $this->_primaryTableRow) {
         return null;
     }
     $tableInfo = $this->_primaryTableRow->getTable()->info();
     $result = array();
     foreach ($tableInfo['primary'] as $primary_key) {
         $result[] = $this->_primaryTableRow->{$primary_key};
     }
     if (count($result) > 1) {
         return $result;
     } else {
         if (count($result) === 1) {
             return $result[0];
         } else {
             return null;
         }
     }
 }