protected function getPrimaryKey(): array
    {
        $primary = array_flip($this->getTable()->getPrimaryKey());

        return array_intersect_key($this->toArray(), $primary);
    }
protected function getPrimaryKey(): array
    {
        $primary = array_flip($this->getTable()->getPrimaryKey());

        return array_intersect_key($this->toArray(), $primary);
    }
protected function getPrimaryKey ( ) : array { $ primary = array_flip ( $ this -> getTable ( ) -> getPrimaryKey ( ) ) ; return array_intersect_key ( $ this -> toArray ( ) , $ primary ) ; }
Retrieves an associative array of primary keys, if it exists

@return array
@throws InvalidPrimaryKeyException
@throws TableNotFoundException
Retrieves an associative array of primary keys if it exists