protected function extractPrimaryKeyFields(EventInterface $event, $strategy = 'automatic')
    {
        $primaryKeyFields = [];

        switch ($strategy) {
            case 'automatic':
                $id = (array)$event->getId();
                if (count($id) === 1) {
                    $id = array_pop($id);
                } else {
                    $id = $this->serialize($id);
                }
                $primaryKeyFields['primary_key'] = $id;
                break;

            case 'properties':
                $id = (array)$event->getId();
                if (count($id) === 1) {
                    $primaryKeyFields['primary_key'] = array_pop($id);
                } else {
                    foreach ($id as $key => $value) {
                        $primaryKeyFields['primary_key_' . $key] = $value;
                    }
                }
                break;

            case 'raw':
                $primaryKeyFields['primary_key'] = $event->getId();
                break;

            case 'serialized':
                $id = $event->getId();
                $primaryKeyFields['primary_key'] = $this->serialize($id);
                break;
        }

        return $primaryKeyFields;
    }
protected function extractPrimaryKeyFields(EventInterface $event, $strategy = 'automatic')
    {
        $primaryKeyFields = [];

        switch ($strategy) {
            case 'automatic':
                $id = (array)$event->getId();
                if (count($id) === 1) {
                    $id = array_pop($id);
                } else {
                    $id = $this->serialize($id);
                }
                $primaryKeyFields['primary_key'] = $id;
                break;

            case 'properties':
                $id = (array)$event->getId();
                if (count($id) === 1) {
                    $primaryKeyFields['primary_key'] = array_pop($id);
                } else {
                    foreach ($id as $key => $value) {
                        $primaryKeyFields['primary_key_' . $key] = $value;
                    }
                }
                break;

            case 'raw':
                $primaryKeyFields['primary_key'] = $event->getId();
                break;

            case 'serialized':
                $id = $event->getId();
                $primaryKeyFields['primary_key'] = $this->serialize($id);
                break;
        }

        return $primaryKeyFields;
    }
protected function extractPrimaryKeyFields ( EventInterface $ event , $ strategy = 'automatic' ) { $ primaryKeyFields = [ ] ; switch ( $ strategy ) { case 'automatic' : $ id = ( array ) $ event -> getId ( ) ; if ( count ( $ id ) === 1 ) { $ id = array_pop ( $ id ) ; } else { $ id = $ this -> serialize ( $ id ) ; } $ primaryKeyFields [ 'primary_key' ] = $ id ; break ; case 'properties' : $ id = ( array ) $ event -> getId ( ) ; if ( count ( $ id ) === 1 ) { $ primaryKeyFields [ 'primary_key' ] = array_pop ( $ id ) ; } else { foreach ( $ id as $ key => $ value ) { $ primaryKeyFields [ 'primary_key_' . $ key ] = $ value ; } } break ; case 'raw' : $ primaryKeyFields [ 'primary_key' ] = $ event -> getId ( ) ; break ; case 'serialized' : $ id = $ event -> getId ( ) ; $ primaryKeyFields [ 'primary_key' ] = $ this -> serialize ( $ id ) ; break ; } return $ primaryKeyFields ; }
Extracts the primary key fields from the audit event object.

@param \AuditStash\EventInterface $event The event object from which to extract the primary key.
@param string $strategy The strategy to use for extracting the primary key.
@return array
Extracts the primary key fields from the audit event object .