Skip to content

Commit

Permalink
Remove all simple references from mappings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
malarzm authored and alcaeus committed Dec 19, 2017
1 parent 34f3a94 commit a647241
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/DocumentManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class WrongSimpleRefDocument
/** @ODM\Id */
public $id;

/** @ODM\ReferenceOne(targetDocument="Documents\Tournament\Participant", simple=true) */
/** @ODM\ReferenceOne(targetDocument="Documents\Tournament\Participant", storeAs="id") */
public $ref;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class GH499Document
/** @ODM\Id */
protected $id;

/** @ODM\ReferenceMany(targetDocument="GH499Document", simple=true, strategy="set") */
/** @ODM\ReferenceMany(targetDocument="GH499Document", storeAs="id", strategy="set") */
protected $refMany;

public function __construct($id = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class GH593User
/** @ODM\Field(name="d", type="bool") */
public $deleted = false;

/** @ODM\ReferenceMany(targetDocument="GH593User", inversedBy="followedBy", simple=true) */
/** @ODM\ReferenceMany(targetDocument="GH593User", inversedBy="followedBy", storeAs="id") */
public $following;

/** @ODM\ReferenceMany(targetDocument="GH593User", mappedBy="following") */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class GH597Post
/** @ODM\EmbedMany(targetDocument="GH597Comment") */
public $comments;

/** @ODM\ReferenceMany(targetDocument="GH597ReferenceMany", simple="true") */
/** @ODM\ReferenceMany(targetDocument="GH597ReferenceMany", storeAs="id") */
public $referenceMany;

public function __construct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class GH602User
/** @ODM\Field(name="user_deleted", type="bool") */
public $deleted = false;

/** @ODM\ReferenceMany(targetDocument="GH602Thing", inversedBy="likedBy", simple=true) */
/** @ODM\ReferenceMany(targetDocument="GH602Thing", inversedBy="likedBy", storeAs="id") */
public $likes;

public function __construct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function testSimpleReferenceRequiresTargetDocument()
'fieldName' => 'assoc',
'reference' => true,
'type' => 'one',
'simple' => true,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_ID,
));
}

Expand All @@ -248,7 +248,7 @@ public function testSimpleAsStringReferenceRequiresTargetDocument()
'fieldName' => 'assoc',
'reference' => true,
'type' => 'one',
'simple' => 'true',
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_ID,
));
}

Expand Down Expand Up @@ -333,7 +333,7 @@ public function testAddInheritedAssociationMapping()
'fieldName' => 'assoc',
'reference' => true,
'type' => 'one',
'simple' => true,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_ID,
);

$cm->addInheritedAssociationMapping($mapping);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public function testDriver()
'type' => 'one',
'reference' => true,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_ID,
'simple' => true,
'targetDocument' => 'Documents\Profile',
'collectionClass' => null,
'cascade' => array('remove', 'persist', 'refresh', 'merge', 'detach'),
Expand Down Expand Up @@ -177,7 +176,6 @@ public function testDriver()
'type' => 'one',
'reference' => true,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF_WITH_DB,
'simple' => false,
'targetDocument' => 'Documents\Account',
'collectionClass' => null,
'cascade' => array('remove', 'persist', 'refresh', 'merge', 'detach'),
Expand Down Expand Up @@ -206,7 +204,6 @@ public function testDriver()
'type' => 'many',
'reference' => true,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF_WITH_DB,
'simple' => false,
'targetDocument' => 'Documents\Group',
'collectionClass' => null,
'cascade' => array('remove', 'persist', 'refresh', 'merge', 'detach'),
Expand Down Expand Up @@ -343,8 +340,7 @@ public function testCollectionPrimers()
'name' => 'references',
'type' => 'many',
'reference' => true,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF_WITH_DB,
'simple' => false,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF,
'targetDocument' => PrimedCollectionDocument::class,
'collectionClass' => null,
'cascade' => [],
Expand Down Expand Up @@ -372,8 +368,7 @@ public function testCollectionPrimers()
'name' => 'inverseMappedBy',
'type' => 'many',
'reference' => true,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF_WITH_DB,
'simple' => false,
'storeAs' => ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF,
'targetDocument' => PrimedCollectionDocument::class,
'collectionClass' => null,
'cascade' => [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<field name="tags" type="collection" />
<embed-one target-document="Documents\Address" field="address" />
<!--<field name="profile" targetDocument="Documents\Profile" reference="true" type="one" cascade="all" />-->
<reference-one target-document="Documents\Profile" field="profile" simple="true" orphan-removal="true">
<reference-one target-document="Documents\Profile" field="profile" store-as="id" orphan-removal="true">
<cascade>
<all />
</cascade>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<document name="TestDocuments\UserNonStringOptions" slave-okay="false">
<field name="id" id="true" />
<reference-one target-document="Documents\Profile" field="profile" simple="true" orphan-removal="true" />
<reference-many target-document="Documents\Group" field="groups" simple="false" orphan-removal="" limit="0" skip="2" />
<reference-one target-document="Documents\Profile" field="profile" store-as="id" orphan-removal="true" />
<reference-many target-document="Documents\Group" field="groups" orphan-removal="" limit="0" skip="2" />
</document>
</doctrine-mongo-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TestDocuments\User:
targetDocument: Documents\Phonenumber
referenceOne:
profile:
simple: true
storeAs: id
targetDocument: Documents\Profile
cascade: all
orphanRemoval: true
Expand Down
8 changes: 4 additions & 4 deletions tests/Doctrine/ODM/MongoDB/Tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,16 @@ class ChildA extends ParentClass
*/
class ChildB extends ParentClass
{
/** @ODM\ReferenceOne(targetDocument="Documents\Feature", simple=true) */
/** @ODM\ReferenceOne(targetDocument="Documents\Feature", storeAs="id") */
public $featureSimple;

/** @ODM\ReferenceMany(targetDocument="Documents\Feature", simple=true) */
/** @ODM\ReferenceMany(targetDocument="Documents\Feature", storeAs="id") */
public $featureSimpleMany;

/** @ODM\ReferenceOne(targetDocument="Documents\Feature", simple=true) */
/** @ODM\ReferenceOne(targetDocument="Documents\Feature", storeAs="id") */
public $conflict;

/** @ODM\ReferenceMany(targetDocument="Documents\Feature", simple=true) */
/** @ODM\ReferenceMany(targetDocument="Documents\Feature", storeAs="id") */
public $conflictMany;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Documents/SimpleReferenceUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class SimpleReferenceUser
/** @ODM\Id */
public $id;

/** @ODM\ReferenceOne(targetDocument="Documents\User", simple=true, name="userId") @ODM\Index */
/** @ODM\ReferenceOne(targetDocument="Documents\User", storeAs="id", name="userId") @ODM\Index */
public $user;

/** @ODM\ReferenceMany(targetDocument="Documents\User", simple=true) */
/** @ODM\ReferenceMany(targetDocument="Documents\User", storeAs="id") */
public $users = array();

/** @ODM\Field(type="string") */
Expand Down
4 changes: 2 additions & 2 deletions tests/Documents/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class User extends BaseDocument
/** @ODM\ReferenceMany(targetDocument="Group", cascade={"all"}) */
protected $groups;

/** @ODM\ReferenceMany(targetDocument="Group", simple=true, cascade={"all"}) */
/** @ODM\ReferenceMany(targetDocument="Group", storeAs="id", cascade={"all"}) */
protected $groupsSimple;

/** @ODM\ReferenceMany(targetDocument="Group", cascade={"all"}, strategy="addToSet") */
Expand All @@ -56,7 +56,7 @@ class User extends BaseDocument
/** @ODM\ReferenceOne(targetDocument="Account", cascade={"all"}) */
protected $account;

/** @ODM\ReferenceOne(targetDocument="Account", simple=true, cascade={"all"}) */
/** @ODM\ReferenceOne(targetDocument="Account", storeAs="id", cascade={"all"}) */
protected $accountSimple;

/** @ODM\Field(type="int") */
Expand Down

0 comments on commit a647241

Please sign in to comment.