1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00
date-poll-api/src/GraphQL/Resolver/ApartmentResolver.php

31 lines
635 B
PHP
Raw Normal View History

2020-10-28 15:46:39 +01:00
<?php
namespace App\GraphQL\Resolver;
use Doctrine\ORM\EntityManager;
use Overblog\GraphQLBundle\Definition\Argument;
use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
use Overblog\GraphQLBundle\Definition\Resolver\ResolverInterface;
class ApartmentResolver implements ResolverInterface {
private $em;
public function __construct( EntityManager $em ) {
$this->em = $em;
}
public function resolve( Argument $args ) {
$apartment = $this->em->getRepository( 'App:Apartment' )->find( $args[ 'id' ] );
return $apartment;
}
public function getAliases() {
return [
'resolve',
'Apartment',
];
}
}