private function addRecord(MutableBag $contentTypeBag, ClassMetadata $metadata, Content $entity)
    {
        $values = [];
        foreach ($metadata->getFieldMappings() as $field) {
            $fieldName = $field['fieldname'];
            $val = $entity->$fieldName;
            if (in_array($field['type'], ['date', 'datetime'])) {
                $val = (string) $entity->$fieldName;
            }
            if (is_callable([$val, 'serialize'])) {
                /** @var Entity $val */
                $val = $val->serialize();
            }
            $values[$fieldName] = $val;
        }

        unset($values['id']);
        $values['_id'] = $entity->getContentType() . '/' . $entity->getSlug();
        $contentTypeBag->add($values);
    }
private function addRecord(MutableBag $contentTypeBag, ClassMetadata $metadata, Content $entity)
    {
        $values = [];
        foreach ($metadata->getFieldMappings() as $field) {
            $fieldName = $field['fieldname'];
            $val = $entity->$fieldName;
            if (in_array($field['type'], ['date', 'datetime'])) {
                $val = (string) $entity->$fieldName;
            }
            if (is_callable([$val, 'serialize'])) {
                /** @var Entity $val */
                $val = $val->serialize();
            }
            $values[$fieldName] = $val;
        }

        unset($values['id']);
        $values['_id'] = $entity->getContentType() . '/' . $entity->getSlug();
        $contentTypeBag->add($values);
    }
private function addRecord ( MutableBag $ contentTypeBag , ClassMetadata $ metadata , Content $ entity ) { $ values = [ ] ; foreach ( $ metadata -> getFieldMappings ( ) as $ field ) { $ fieldName = $ field [ 'fieldname' ] ; $ val = $ entity -> $ fieldName ; if ( in_array ( $ field [ 'type' ] , [ 'date' , 'datetime' ] ) ) { $ val = ( string ) $ entity -> $ fieldName ; } if ( is_callable ( [ $ val , 'serialize' ] ) ) { /** @var Entity $val */ $ val = $ val -> serialize ( ) ; } $ values [ $ fieldName ] = $ val ; } unset ( $ values [ 'id' ] ) ; $ values [ '_id' ] = $ entity -> getContentType ( ) . '/' . $ entity -> getSlug ( ) ; $ contentTypeBag -> add ( $ values ) ; }
Add a single record to the export data.

@param MutableBag    $contentTypeBag
@param ClassMetadata $metadata
@param Content       $entity
Add a single record to the export data .