-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Conversation
$unique = true; | ||
$optional = isset($mapping['joinColumns'][0]['nullable']) ? $mapping['joinColumns'][0]['nullable'] : false; | ||
break; | ||
if ($this->class instanceof \Doctrine\ORM\Mapping\ClassMetadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be imported shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As described here : http://php.net/manual/en/language.operators.type.php (part.7) , no it shouldn't.
If I do something like this:
<?php
$faker = \Faker\Factory::create();
$isFooBar = $faker instanceof \Foo\Bar;
$isFooBar
value is false.
The test can be rewritten like this if we want
if ($this->class instanceof '\Doctrine\ORM\Mapping\ClassMetadata') {
If we want, for more clarity, we can split class to Faker\ORM\Doctrine\EntityPopulator
and Faker\ORM\Doctrine\DocumentPopulator
, and add an addDocument
in Faker\ORM\Doctrine\Populator
, for using Entity
for ORM use and Document
for ODM use.
@beberlei Could you validate this PR for me please? I have no idea if it may break things or not... |
@lexicalbits any feedback on this one? |
@fzaninotto I don't think it bears on the issue I raised in #475, so no comments from me. |
Could you rebase on master? |
Changes Faker\ORM\Doctrine\EntityPopulator to manage Doctrine ODM Documents. Using the Class Doctrine\Common\Persistence\Mapping\ClassMetadata instead of Doctrine\ORM\Mapping\ClassMetadata Managing ODM ReferenceOne as ORM One-To-One relations (\Doctrine\ODM\MongoDB\Mapping\ClassMetadata does not have the getAssociationMappings function, I retrieve associationMappings using the exposed public var) Changes generateId's signature to avoid using Doctrine\ORM\EntityManagerInterface; uses Doctrine\Common\Persistence\ObjectManager instead.
Changes Faker\ORM\Doctrine\EntityPopulator to manage Doctrine ODM Documents. Using the Class Doctrine\Common\Persistence\Mapping\ClassMetadata instead of Doctrine\ORM\Mapping\ClassMetadata Managing ODM ReferenceOne as ORM One-To-One relations (\Doctrine\ODM\MongoDB\Mapping\ClassMetadata does not have the getAssociationMappings function, I retrieve associationMappings using the exposed public var) Changes generateId's signature to avoid using Doctrine\ORM\EntityManagerInterface; uses Doctrine\Common\Persistence\ObjectManager instead.
It's done |
Thanks! |
Changes
Faker\ORM\Doctrine\EntityPopulator
to manage Doctrine ODM Documents.Using the Class
Doctrine\Common\Persistence\Mapping\ClassMetadata
instead ofDoctrine\ORM\Mapping\ClassMetadata
Managing ODM ReferenceOne as ORM One-To-One relations
(
\Doctrine\ODM\MongoDB\Mapping\ClassMetadata
does not have thegetAssociationMappings
function, I retrieveassociationMappings
using the exposed public var)Changes generateId's signature to avoid using
Doctrine\ORM\EntityManagerInterface
; usesDoctrine\Common\Persistence\ObjectManager
instead.