public function key()
    {
        if (empty($this->key) && !empty($this->definition->primary)) {
            $keys = array_values(
                array_filter(
                    preg_split('~[\s,]+~', $this->definition->primary)
                )
            );
            $keys = array_map(
                function ($key) {
                    return Normalise::toVariable($key);
                },
                $keys
            );

            $this->key = count($keys) > 1 ? $keys : array_shift($keys);
        }

        if (empty($this->key) && $this->has('id')) {
            $this->key = 'id';
        }

        return $this->key;
    }
public function key()
    {
        if (empty($this->key) && !empty($this->definition->primary)) {
            $keys = array_values(
                array_filter(
                    preg_split('~[\s,]+~', $this->definition->primary)
                )
            );
            $keys = array_map(
                function ($key) {
                    return Normalise::toVariable($key);
                },
                $keys
            );

            $this->key = count($keys) > 1 ? $keys : array_shift($keys);
        }

        if (empty($this->key) && $this->has('id')) {
            $this->key = 'id';
        }

        return $this->key;
    }
public function key ( ) { if ( empty ( $ this -> key ) && ! empty ( $ this -> definition -> primary ) ) { $ keys = array_values ( array_filter ( preg_split ( '~[\s,]+~' , $ this -> definition -> primary ) ) ) ; $ keys = array_map ( function ( $ key ) { return Normalise :: toVariable ( $ key ) ; } , $ keys ) ; $ this -> key = count ( $ keys ) > 1 ? $ keys : array_shift ( $ keys ) ; } if ( empty ( $ this -> key ) && $ this -> has ( 'id' ) ) { $ this -> key = 'id' ; } return $ this -> key ; }
Get the field for the primary key.

@return  string  The name of the field
Get the field for the primary key .