original_string: public function findByPK()
      {
          $pk = func_get_args();
          if (!$this->_properties['primary_key'] || !$pk)
              throw new Exception(sprintf(self::E_PrimaryKey, get_called_class()), 1);
  
          !is_array(reset($pk)) || $pk = array_shift($pk);
          $criteria = $values = array();
          foreach ($this->_properties['primary_key'] as $field) {
              $token = ':pk_'.$field;
              $criteria[] = '{table}.'.$field.'='.$token;
              $values[$token] = isset($pk[$field])?$pk[$field]:array_shift($pk);
          }
  
          return $this->limit(1)->find(implode(' and ', $criteria), $values);
      }
code: public function findByPK()
      {
          $pk = func_get_args();
          if (!$this->_properties['primary_key'] || !$pk)
              throw new Exception(sprintf(self::E_PrimaryKey, get_called_class()), 1);
  
          !is_array(reset($pk)) || $pk = array_shift($pk);
          $criteria = $values = array();
          foreach ($this->_properties['primary_key'] as $field) {
              $token = ':pk_'.$field;
              $criteria[] = '{table}.'.$field.'='.$token;
              $values[$token] = isset($pk[$field])?$pk[$field]:array_shift($pk);
          }
  
          return $this->limit(1)->find(implode(' and ', $criteria), $values);
      }
code_tokens: public function findByPK ( ) { $ pk = func_get_args ( ) ; if ( ! $ this -> _properties [ 'primary_key' ] || ! $ pk ) throw new Exception ( sprintf ( self :: E_PrimaryKey , get_called_class ( ) ) , 1 ) ; ! is_array ( reset ( $ pk ) ) || $ pk = array_shift ( $ pk ) ; $ criteria = $ values = array ( ) ; foreach ( $ this -> _properties [ 'primary_key' ] as $ field ) { $ token = ':pk_' . $ field ; $ criteria [ ] = '{table}.' . $ field . '=' . $ token ; $ values [ $ token ] = isset ( $ pk [ $ field ] ) ? $ pk [ $ field ] : array_shift ( $ pk ) ; } return $ this -> limit ( 1 ) -> find ( implode ( ' and ' , $ criteria ) , $ values ) ; }
docstring: Find by PK
docstring_tokens: Find by PK