why return int(1) instead of an object?? #6281

Closed
opened 2026-01-22 15:30:06 +01:00 by admin · 1 comment
Owner

Originally created by @ZvanYang on GitHub (Aug 16, 2019).

Originally assigned to: @Ocramius on GitHub.

public function findByRightId($state, $userRightId, $userId)
{
    return  $this->createQueryBuilder('u')
        ->andWhere('u.state = :state')
        ->andWhere('u.id = :id')
        ->andWhere('u.userId = :userId')
        ->andWhere('u.estate = :estate')
        ->setParameter('state', $state)
        ->setParameter('id', $userRightId)
        ->setParameter('userId', $userId)
        ->setParameter('estate', EstateEnum::VALID)
        ->getQuery()
        ->getOneOrNullResult();
}

in prod ,it return int(1);

in test, it return an object.

Originally created by @ZvanYang on GitHub (Aug 16, 2019). Originally assigned to: @Ocramius on GitHub. public function findByRightId($state, $userRightId, $userId) { return $this->createQueryBuilder('u') ->andWhere('u.state = :state') ->andWhere('u.id = :id') ->andWhere('u.userId = :userId') ->andWhere('u.estate = :estate') ->setParameter('state', $state) ->setParameter('id', $userRightId) ->setParameter('userId', $userId) ->setParameter('estate', EstateEnum::VALID) ->getQuery() ->getOneOrNullResult(); } in prod ,it return int(1); in test, it return an object.
admin added the Can't FixQuestion labels 2026-01-22 15:30:06 +01:00
admin closed this issue 2026-01-22 15:30:06 +01:00
Author
Owner

@Ocramius commented on GitHub (Aug 17, 2019):

in test, it return an object.

You'd need to debug it yourself to provide a failing test case for this repo.

Closing here, since we can't help further, unoess we know what createQueryBuilder looks like in your test environment.

@Ocramius commented on GitHub (Aug 17, 2019): > in test, it return an object. You'd need to debug it yourself to provide a failing test case for this repo. Closing here, since we can't help further, unoess we know what `createQueryBuilder` looks like in your test environment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6281