Skip to content

Manage findOneBy and findBy #19

Closed
Closed
@soullivaneuh

Description

@soullivaneuh

This:

$dnsDomain = $dnsEntityManager->getRepository('PowerDNSBundle:PowerDNSDomain')->findOneBy([
    'ownerId' => $user->getId()
]);
if (!$dnsDomain) {
    throw new \RuntimeException("Unable to find DNS domain of user {$user->getUsername()}");
}
$client->request('DELETE', $this->getUrl('api_delete_dns', [
    'domain' => $dnsDomain->getId(),
]));

Should work because I check if $dnsDomain is not null. But I have:

Call to an undefined method object::getId().

Certainly because only the find method is managed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions