8000 Add microseconds support on datetime/time types · Issue #6510 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add microseconds support on datetime/time types #6510
Closed
@Khodl

Description

@Khodl

First of all, sorry if this has already been reported, but I already checked for 3 days a solution without succeeding.

Here is my situation:

I implement a parent class, GenericMessage

 * Message
 *
 * @ORM\Table(name="message")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\MessageRepository")
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="message_type", type="string")
 * @ORM\DiscriminatorMap({
 *      "gallery" = "GalleryMessage",
 *      "text" = "TextMessage",
 * })
 */
abstract class GenericMessage {
...

with (at least) two children:

/**
 * GalleryMessage
 *
 * @ORM\Table(name="message_gallery")
 * @ORM\Entity()
 */
class GalleryMessage extends GenericMessage
{

and

/**
 * TextMessage
 *
 * @ORM\Table(name="message_text")
 * @ORM\Entity()
 */
class TextMessage extends GenericMessage
{

Then I insert create different instances of these two messages:

$t1 = new TextMessage();
$g1 = new GalleryMessage();
$t2 = new TextMessage();

$em->persist($t1);
$em->persist($g1);
$em->persist($t2);
$em->flush();

However, the id are not in the right order, as inserts are nested by entity by the UnitOfWork, if I understood the code well.

Therefore, if we sort by id, we would get $t1, $t2, $g1 instead of $t1, $g1, $t2.

Inserts order are:

  1. GenericMessage --> get id (for instance 4)
  2. TextMessage -> insert with id 4
  3. GenericMessage --> get id (for instance 5)
  4. TextMessage -> insert with id 5
  5. GenericMessage --> get id (for instance 6)
  6. GalleryMessage -> insert with id 6

Is there any way to make all the insertions in the right order? For instance insert all the GenericMessage rows, then collect the ids, and the the order doesn't matter?

For instance:

  1. GenericMessage --> get id (for instance 4)
  2. GenericMessage --> get id (for instance 5)
  3. GenericMessage --> get id (for instance 6)
  4. TextMessage -> insert with id 4
  5. TextMessage -> insert with id 6
  6. GalleryMessage -> insert with id 5

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0