Completed
Branch EDTR/master (0d7008)
by
unknown
34:37 queued 26:06
created

TicketDatetimesConnection::resolveNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\services\graphql\connections;
4
5
use EE_Base_Class;
6
use EEM_Datetime;
7
use EventEspresso\core\domain\services\graphql\connection_resolvers\DatetimeConnectionResolver;
8
use EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection;
9
use EventEspresso\core\services\graphql\connections\ConnectionBase;
10
use Exception;
11
12
/**
13
 * Class TicketDatetimesConnection
14
 * Description
15
 *
16
 * @package EventEspresso\core\domain\services\graphql\connections
17
 * @author  Brent Christensen
18
 * @since   $VID:$
19
 */
20
class TicketDatetimesConnection extends ConnectionBase
21
{
22
23
24
    /**
25
     * DatetimeConnection constructor.
26
     *
27
     * @param EEM_Datetime $model
28
     */
29
    public function __construct(EEM_Datetime $model)
30
    {
31
        $this->model = $model;
32
    }
33
34
35
    /**
36
     * @return array
37
     * @since $VID:$
38
     */
39 View Code Duplication
    public function config()
40
    {
41
        return [
42
            'fromType'           => $this->namespace . 'Ticket',
43
            'toType'             => $this->namespace . 'Datetime',
44
            'fromFieldName'      => 'datetimes',
45
            'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection",
46
            'connectionArgs'     => EventDatetimesConnection::get_connection_args(),
47
            'resolve'            => [$this, 'resolveConnection'],
48
        ];
49
    }
50
51
52
    /**
53
     * @param $entity
54
     * @param $args
55
     * @param $context
56
     * @param $info
57
     * @return array
58
     * @throws Exception
59
     * @since $VID:$
60
     */
61
    public function resolveConnection($entity, $args, $context, $info)
62
    {
63
        $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info);
64
        return $resolver->get_connection();
65
    }
66
}
67