Category : orm

There was a problem: The project uses Cycle ORM, there are 2 Entities. I am trying to link them using annotation like so: /** * @CycleRelationBelongsTo(target = "CompanyCoreEntityCourtInfoCourtInfo") */ protected $court; But when accessing $repository->findOne()->getCourt() I get: object(CycleORMPromiseReference)#2212 (2) { ["role":"CycleORMPromiseReference":private]=> string(42) "CompanyCoreEntityCourtInfoCourtInfo" ["scope":"CycleORMPromiseReference":private]=> array(1) { ["id"]=> int(15705) } } But I want to get ..

Read more

With prior versions of Symfony (<5), it was possible to automatically populate DateTime-fields on creation or when updating existing entries. Example: /** * @var DateTime $createdAt * @GedmoTimestampable(on="create") * @ORMColumn(type="datetime") */ private $createdAt; These annotations do not seem to have any effect if applied onto an Entity in a Symfony5 project. Has a replacement for ..

Read more

I have custom type that uses precision option to generate SQL Declaration. class DateTimePrecisionType extends VarDateTimeType { public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { if (isset($column[‘precision’])) { return sprintf(‘DATETIME(%d)’, $column[‘precision’]); } return parent::getSQLDeclaration($column, $platform); } } Everything works fine as long as I’m creating new columns with my custom type. When I try to ..

Read more

To explain the problem: Imagine you have two database entities User and Group. The OO implementation has two classes UserModel and GroupModel which should map these entities. UserModel should have a method getGroups() (returning instances of GroupModel) to retrieve all Groups belonging to this particular user. Therefore UserModelmust interact with the GroupModel class. And GroupModel ..

Read more

There is a slim+doctrine project, the entity is created as follows: Выполняется команда vendor/bin/doctrine orm:convert-mapping -f –from-database, getting a class (File path: mappings/) namespace AppDomain; use DoctrineORMMapping as ORM; /** * @ORMEntity * @ORMTable(name="test") */ class Test { /** * @ORMId() * @ORMColumn(type="integer") * @ORMGeneratedValue * @var integer */ protected $id; /** * @ORMColumn(type="string") * ..

Read more