Category : doctrine-odm

Setup I’m using mongoDB in API Platform and I created the following Attribute document: /** * @ApiResource * @ODMDocument */ class Attribute { /** * @ODMEmbedOne( * discriminatorField="type", * discriminatorMap={ * "string"=ValueString::class, * "number"=ValueNumber::class * }, * defaultDiscriminatorValue="string" * ) */ public $value; } The attribute document can embed one of the following EmbeddedDocuments: /** ..

Read more

I’m trying to order my embed documents. The field looks like this /** * @ODMEmbedMany(targetDocument=Image::class, strategy="set") * @ODMIndex(keys={"order"="asc"}) * @Groups({"offer:read"}) */ protected $images = []; The Image EmbeddedDocument namespace AppDocumentEmbedded; use AppDocumentTraitsNameableTrait; use AppDocumentTraitsOrderableTrait; use DoctrineODMMongoDBMappingAnnotations as ODM; /** * @ODMEmbeddedDocument */ class Image { use NameableTrait; use OrderableTrait; … } And the orderable trait ..

Read more

I’m trying to order my embed documents. The field looks like this /** * @ODMEmbedMany(targetDocument=Image::class, strategy="set") * @ODMIndex(keys={"order"="asc"}) * @Groups({"offer:read"}) */ protected $images = []; The Image EmbeddedDocument namespace AppDocumentEmbedded; use AppDocumentTraitsNameableTrait; use AppDocumentTraitsOrderableTrait; use DoctrineODMMongoDBMappingAnnotations as ODM; /** * @ODMEmbeddedDocument */ class Image { use NameableTrait; use OrderableTrait; … } And the orderable trait ..

Read more

I am facing an error with symfony and mongoDB odm on one to one relationship for example i have a user that has Work . User Class: /** * @MongoDBDocument * @MongoDBUnique(fields="email") */ class User implements UserInterface { /** * @MongoDBId */ private $id; /** * @MongoDBField(type="string") */ private $firstName; /** * @MongoDBField(type="string") */ private ..

Read more