Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
mongodb-version:
- "8.0"
- "7.0"
Expand Down
10 changes: 5 additions & 5 deletions docs/en/reference/migrating-schemas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ before normal hydration.
}
}

The annotation is defined with one or a list of field names. During hydration,
The attribute is defined with one or a list of field names. During hydration,
these fields will be checked in order and, for each field present, the annotated
method will be invoked with its value as a single argument. Since the
``firstName`` and ``lastName`` fields are mapped, they would then be updated
Expand All @@ -152,10 +152,10 @@ Moving Fields
Migrating your schema can be a difficult task, but Doctrine provides a few
different methods for dealing with it:

- **@AlsoLoad** - load values from old fields or transform data through methods
- **@Field(notSaved=true)** - load values into fields without saving them again
- **@PostLoad** - execute code after all fields have been loaded
- **@PrePersist** - execute code before your document gets saved
- ``#[AlsoLoad]`` - load values from old fields or transform data through methods
- ``#[Field(notSaved: true)]`` - load values into fields without saving them again
- ``#[PostLoad]`` - execute code after all fields have been loaded
- ``#[PrePersist]`` - execute code before your document gets saved

Imagine you have some address-related fields on a Person document:

Expand Down
2 changes: 1 addition & 1 deletion src/Aggregation/Stage/VectorSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getExpression(): array
}

if ($this->queryVector !== null) {
$params['queryVector'] = Type::getType($this->persister->getClassMetadata()->fieldMappings[$this->path]['type'] ?? Type::RAW)->convertToDatabaseValue($this->queryVector);
$params['queryVector'] = Type::getType($this->persister->getClassMetadata()->fieldMappings[$this->path ?? '']['type'] ?? Type::RAW)->convertToDatabaseValue($this->queryVector);
}

return [$this->getStageName() => $params];
Expand Down
4 changes: 2 additions & 2 deletions src/Persisters/DocumentPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ private function loadEmbedManyCollection(PersistentCollectionInterface $collecti
$this->uow->setParentAssociation($embeddedDocumentObject, $mapping, $owner, $mapping['name'] . '.' . $key);

$data = $this->hydratorFactory->hydrate($embeddedDocumentObject, $embeddedDocument, $collection->getHints());
$id = $data[$embeddedMetadata->identifier] ?? null;
$id = $data[$embeddedMetadata->identifier ?? ''] ?? null;

if (empty($collection->getHints()[Query::HINT_READ_ONLY])) {
$this->uow->registerManaged($embeddedDocumentObject, $id, $data);
Expand Down Expand Up @@ -994,7 +994,7 @@ public function prepareFieldName(string $fieldName): string
*/
public function addDiscriminatorToPreparedQuery(array $preparedQuery): array
{
if (isset($preparedQuery[$this->class->discriminatorField]) || $this->class->discriminatorField === null) {
if ($this->class->discriminatorField === null || isset($preparedQuery[$this->class->discriminatorField])) {
return $preparedQuery;
}

Expand Down