Skip to content

Commit

Permalink
Remove targetDocument autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
malarzm committed May 4, 2022
1 parent df2ab97 commit ac895f4
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 31 deletions.
12 changes: 0 additions & 12 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1551,10 +1551,6 @@ public function mapOneEmbedded(array $mapping): void
$mapping['embedded'] = true;
$mapping['type'] = self::ONE;

if ($this->isTypedProperty($mapping['fieldName'])) {
$mapping = $this->validateAndCompleteTypedAssociationMapping($mapping);
}

$this->mapField($mapping);
}

Expand All @@ -1580,10 +1576,6 @@ public function mapOneReference(array $mapping): void
$mapping['reference'] = true;
$mapping['type'] = self::ONE;

if ($this->isTypedProperty($mapping['fieldName'])) {
$mapping = $this->validateAndCompleteTypedAssociationMapping($mapping);
}

$this->mapField($mapping);
}

Expand Down Expand Up @@ -2669,10 +2661,6 @@ private function validateAndCompleteTypedAssociationMapping(array $mapping): arr
return $mapping;
}

if (! isset($mapping['targetDocument']) && $mapping['type'] === self::ONE) {
$mapping['targetDocument'] = $type->getName();
}

if (
! isset($mapping['collectionClass'])
&& $mapping['type'] === self::MANY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Reflection\EnumReflectionProperty;
use Documents74\CustomCollection;
use Documents74\TypedEmbeddedDocument;
use Documents74\UserTyped;
use Documents81\Card;
use Documents81\Suit;
Expand Down Expand Up @@ -216,9 +215,6 @@ public function testFieldTypeFromReflection(): void
$this->assertSame(Type::BOOL, $class->getTypeOfField('boolean'));
$this->assertSame(Type::FLOAT, $class->getTypeOfField('float'));

$this->assertSame(TypedEmbeddedDocument::class, $class->getAssociationTargetClass('embedOne'));
$this->assertSame(UserTyped::class, $class->getAssociationTargetClass('referenceOne'));

$this->assertSame(CustomCollection::class, $class->getAssociationCollectionClass('embedMany'));
$this->assertSame(CustomCollection::class, $class->getAssociationCollectionClass('referenceMany'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use Documents\UserName;
use Documents\UserRepository;
use Documents74\CustomCollection;
use Documents74\TypedEmbeddedDocument;
use Documents74\UserTyped;
use Documents81\Card;
use Documents81\Suit;
Expand Down Expand Up @@ -178,12 +177,6 @@ public function testFieldTypeFromReflection(): void
$cm->mapField(['fieldName' => 'int']);
self::assertEquals(Type::INT, $cm->getTypeOfField('int'));

$cm->mapOneEmbedded(['fieldName' => 'embedOne']);
self::assertEquals(TypedEmbeddedDocument::class, $cm->getAssociationTargetClass('embedOne'));

$cm->mapOneReference(['fieldName' => 'referenceOne']);
self::assertEquals(UserTyped::class, $cm->getAssociationTargetClass('referenceOne'));

$cm->mapManyEmbedded(['fieldName' => 'embedMany']);
self::assertEquals(CustomCollection::class, $cm->getAssociationCollectionClass('embedMany'));

Expand Down
8 changes: 0 additions & 8 deletions tests/Documents74/UserTyped.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ class UserTyped
#[ODM\Field]
public int $int;

/** @ODM\EmbedOne */
#[ODM\EmbedOne]
public TypedEmbeddedDocument $embedOne;

/** @ODM\ReferenceOne */
#[ODM\ReferenceOne]
public UserTyped $referenceOne;

/** @ODM\EmbedMany */
#[ODM\EmbedMany]
public CustomCollection $embedMany;
Expand Down

0 comments on commit ac895f4

Please sign in to comment.