private function mapCollectionType($fieldName, Field $field, ClassMetadata $metadata) { $options = $field->getOptions(); $collectionField = $this->fieldLoader->load($options['field_type'], FieldOptions::create($options['field_options'])); // assume that other types are scalars... $this->__invoke($fieldName, $collectionField, $metadata, ['serialize_scalar' => true]); }
private function mapCollectionType($fieldName, Field $field, ClassMetadata $metadata) { $options = $field->getOptions(); $collectionField = $this->fieldLoader->load($options['field_type'], FieldOptions::create($options['field_options'])); if ($collectionField->getStorageType() === Type\ObjectType::class) { $options = $collectionField->getStorageOptions(); $this->unrestrictChildClass($options['class'], $metadata); $metadata->mapChildren(['fieldName' => $fieldName, 'fetchDepth' => 1, 'filter' => $this->encoder->encode($fieldName) . '-*', 'cascade' => ClassMetadata::CASCADE_ALL, 'nullable' => true]); return; } if ($collectionField->getStorageType() === Type\ReferenceType::class) { $metadata->mapManyToMany(['fieldName' => $fieldName, 'strategy' => 'hard', 'nullable' => true, 'cascade' => ClassMetadata::CASCADE_ALL]); return; } // assume that other types are scalars... $this->__invoke($fieldName, $collectionField, $metadata, ['multivalue' => true]); }