Creating entity named Transaction triggers error #6080

Closed
opened 2026-01-22 15:26:29 +01:00 by admin · 2 comments
Owner

Originally created by @AlexanderMatveev on GitHub (Oct 6, 2018).

Bug Report

Q A
Version 2.5

Current behavior

Getting exception:

Notice: Undefined index: transactions

How to reproduce

  1. Create Symfony entity named Transaction
  2. Query using QueryBuilder:
$qb = $em->createQueryBuilder()
            ->select('t')
            ->from(Transaction::class, 't')
            ->orderBy('t.createdAt', 'DESC')
            ->setMaxResults($limit)
            ->setFirstResult($limit * $page);
        $qb->getQuery()->getResult();
Originally created by @AlexanderMatveev on GitHub (Oct 6, 2018). ### Bug Report | Q | A |------------ | ------ | Version | 2.5 #### Current behavior Getting exception: > Notice: Undefined index: transactions #### How to reproduce 1. Create Symfony entity named Transaction 2. Query using QueryBuilder: ```php $qb = $em->createQueryBuilder() ->select('t') ->from(Transaction::class, 't') ->orderBy('t.createdAt', 'DESC') ->setMaxResults($limit) ->setFirstResult($limit * $page); $qb->getQuery()->getResult(); ```
admin closed this issue 2026-01-22 15:26:29 +01:00
Author
Owner

@Ocramius commented on GitHub (Oct 6, 2018):

What's a "named Transaction"?

@Ocramius commented on GitHub (Oct 6, 2018): What's a "named Transaction"?
Author
Owner

@AlexanderMatveev commented on GitHub (Oct 6, 2018):

@Ocramius Transaction is entity name, see https://symfony.com/doc/current/doctrine.html

For example:

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class Transaction {
// ...

Anyway, I figured out that this exception is throwing because of missing of backward-direction reference from related entity class. Thanks for response.

@AlexanderMatveev commented on GitHub (Oct 6, 2018): @Ocramius Transaction is entity name, see https://symfony.com/doc/current/doctrine.html For example: ```php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity */ class Transaction { // ... ``` Anyway, I figured out that this exception is throwing because of missing of backward-direction reference from related entity class. Thanks for response.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6080