| @@ 37-102 (lines=66) @@ | ||
| 34 | * @author Brent Christensen |
|
| 35 | * @since $VID:$ |
|
| 36 | */ |
|
| 37 | class DatetimeTicketsConnection implements ConnectionInterface |
|
| 38 | { |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @var EEM_Ticket $model |
|
| 42 | */ |
|
| 43 | protected $model; |
|
| 44 | ||
| 45 | ||
| 46 | /** |
|
| 47 | * DatetimeConnection constructor. |
|
| 48 | * |
|
| 49 | * @param EEM_Ticket $model |
|
| 50 | */ |
|
| 51 | public function __construct(EEM_Ticket $model) |
|
| 52 | { |
|
| 53 | $this->model = $model; |
|
| 54 | } |
|
| 55 | ||
| 56 | ||
| 57 | /** |
|
| 58 | * @return array |
|
| 59 | * @since $VID:$ |
|
| 60 | */ |
|
| 61 | public function config() |
|
| 62 | { |
|
| 63 | return [ |
|
| 64 | 'fromType' => 'Datetime', |
|
| 65 | 'toType' => 'Ticket', |
|
| 66 | 'fromFieldName' => 'tickets', |
|
| 67 | 'connectionTypeName' => 'DatetimeTicketsConnection', |
|
| 68 | 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | ]; |
|
| 71 | } |
|
| 72 | ||
| 73 | ||
| 74 | /** |
|
| 75 | * @param $entity |
|
| 76 | * @param $args |
|
| 77 | * @param $context |
|
| 78 | * @param $info |
|
| 79 | * @return array |
|
| 80 | * @throws Exception |
|
| 81 | * @since $VID:$ |
|
| 82 | */ |
|
| 83 | public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | { |
|
| 85 | $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 86 | return $resolver->get_connection(); |
|
| 87 | } |
|
| 88 | ||
| 89 | ||
| 90 | /** |
|
| 91 | * @param $id |
|
| 92 | * @param $args |
|
| 93 | * @param $context |
|
| 94 | * @param $info |
|
| 95 | * @return EE_Base_Class |
|
| 96 | * @since $VID:$ |
|
| 97 | */ |
|
| 98 | public function resolveNode($id, $args, $context, $info) |
|
| 99 | { |
|
| 100 | return $this->model->get_one_by_ID($id); |
|
| 101 | } |
|
| 102 | } |
|
| @@ 37-102 (lines=66) @@ | ||
| 34 | * @author Brent Christensen |
|
| 35 | * @since $VID:$ |
|
| 36 | */ |
|
| 37 | class EventDatetimesConnection implements ConnectionInterface |
|
| 38 | { |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @var EEM_Datetime $model |
|
| 42 | */ |
|
| 43 | protected $model; |
|
| 44 | ||
| 45 | ||
| 46 | /** |
|
| 47 | * DatetimeConnection constructor. |
|
| 48 | * |
|
| 49 | * @param EEM_Datetime $model |
|
| 50 | */ |
|
| 51 | public function __construct(EEM_Datetime $model) |
|
| 52 | { |
|
| 53 | $this->model = $model; |
|
| 54 | } |
|
| 55 | ||
| 56 | ||
| 57 | /** |
|
| 58 | * @return array |
|
| 59 | * @since $VID:$ |
|
| 60 | */ |
|
| 61 | public function config() |
|
| 62 | { |
|
| 63 | return [ |
|
| 64 | 'fromType' => 'Event', |
|
| 65 | 'toType' => 'Datetime', |
|
| 66 | 'fromFieldName' => 'datetimes', |
|
| 67 | 'connectionTypeName' => 'EventDatetimesConnection', |
|
| 68 | 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | ]; |
|
| 71 | } |
|
| 72 | ||
| 73 | ||
| 74 | /** |
|
| 75 | * @param $entity |
|
| 76 | * @param $args |
|
| 77 | * @param $context |
|
| 78 | * @param $info |
|
| 79 | * @return array |
|
| 80 | * @throws Exception |
|
| 81 | * @since $VID:$ |
|
| 82 | */ |
|
| 83 | public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | { |
|
| 85 | $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 86 | return $resolver->get_connection(); |
|
| 87 | } |
|
| 88 | ||
| 89 | ||
| 90 | /** |
|
| 91 | * @param $id |
|
| 92 | * @param $args |
|
| 93 | * @param $context |
|
| 94 | * @param $info |
|
| 95 | * @return EE_Base_Class |
|
| 96 | * @since $VID:$ |
|
| 97 | */ |
|
| 98 | public function resolveNode($id, $args, $context, $info) |
|
| 99 | { |
|
| 100 | return $this->model->get_one_by_ID($id); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| @@ 37-102 (lines=66) @@ | ||
| 34 | * @author Brent Christensen |
|
| 35 | * @since $VID:$ |
|
| 36 | */ |
|
| 37 | class EventVenuesConnection implements ConnectionInterface |
|
| 38 | { |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @var EEM_Venue $model |
|
| 42 | */ |
|
| 43 | protected $model; |
|
| 44 | ||
| 45 | ||
| 46 | /** |
|
| 47 | * DatetimeConnection constructor. |
|
| 48 | * |
|
| 49 | * @param EEM_Venue $model |
|
| 50 | */ |
|
| 51 | public function __construct(EEM_Venue $model) |
|
| 52 | { |
|
| 53 | $this->model = $model; |
|
| 54 | } |
|
| 55 | ||
| 56 | ||
| 57 | /** |
|
| 58 | * @return array |
|
| 59 | * @since $VID:$ |
|
| 60 | */ |
|
| 61 | public function config() |
|
| 62 | { |
|
| 63 | return [ |
|
| 64 | 'fromType' => 'Event', |
|
| 65 | 'toType' => 'Venue', |
|
| 66 | 'fromFieldName' => 'venues', |
|
| 67 | 'connectionTypeName' => 'EventVenuesConnection', |
|
| 68 | 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | ]; |
|
| 71 | } |
|
| 72 | ||
| 73 | ||
| 74 | /** |
|
| 75 | * @param $entity |
|
| 76 | * @param $args |
|
| 77 | * @param $context |
|
| 78 | * @param $info |
|
| 79 | * @return array |
|
| 80 | * @throws Exception |
|
| 81 | * @since $VID:$ |
|
| 82 | */ |
|
| 83 | public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | { |
|
| 85 | $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
| 86 | return $resolver->get_connection(); |
|
| 87 | } |
|
| 88 | ||
| 89 | ||
| 90 | /** |
|
| 91 | * @param $id |
|
| 92 | * @param $args |
|
| 93 | * @param $context |
|
| 94 | * @param $info |
|
| 95 | * @return EE_Base_Class |
|
| 96 | * @since $VID:$ |
|
| 97 | */ |
|
| 98 | public function resolveNode($id, $args, $context, $info) |
|
| 99 | { |
|
| 100 | return $this->model->get_one_by_ID($id); |
|
| 101 | } |
|
| 102 | } |
|
| @@ 37-102 (lines=66) @@ | ||
| 34 | * @author Brent Christensen |
|
| 35 | * @since $VID:$ |
|
| 36 | */ |
|
| 37 | class TicketDatetimesConnection implements ConnectionInterface |
|
| 38 | { |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @var EEM_Datetime $model |
|
| 42 | */ |
|
| 43 | protected $model; |
|
| 44 | ||
| 45 | ||
| 46 | /** |
|
| 47 | * DatetimeConnection constructor. |
|
| 48 | * |
|
| 49 | * @param EEM_Datetime $model |
|
| 50 | */ |
|
| 51 | public function __construct(EEM_Datetime $model) |
|
| 52 | { |
|
| 53 | $this->model = $model; |
|
| 54 | } |
|
| 55 | ||
| 56 | ||
| 57 | /** |
|
| 58 | * @return array |
|
| 59 | * @since $VID:$ |
|
| 60 | */ |
|
| 61 | public function config() |
|
| 62 | { |
|
| 63 | return [ |
|
| 64 | 'fromType' => 'Ticket', |
|
| 65 | 'toType' => 'Datetime', |
|
| 66 | 'fromFieldName' => 'datetimes', |
|
| 67 | 'connectionTypeName' => 'TicketDatetimesConnection', |
|
| 68 | 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | ]; |
|
| 71 | } |
|
| 72 | ||
| 73 | ||
| 74 | /** |
|
| 75 | * @param $entity |
|
| 76 | * @param $args |
|
| 77 | * @param $context |
|
| 78 | * @param $info |
|
| 79 | * @return array |
|
| 80 | * @throws Exception |
|
| 81 | * @since $VID:$ |
|
| 82 | */ |
|
| 83 | public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | { |
|
| 85 | $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 86 | return $resolver->get_connection(); |
|
| 87 | } |
|
| 88 | ||
| 89 | ||
| 90 | /** |
|
| 91 | * @param $id |
|
| 92 | * @param $args |
|
| 93 | * @param $context |
|
| 94 | * @param $info |
|
| 95 | * @return EE_Base_Class |
|
| 96 | * @since $VID:$ |
|
| 97 | */ |
|
| 98 | public function resolveNode($id, $args, $context, $info) |
|
| 99 | { |
|
| 100 | return $this->model->get_one_by_ID($id); |
|
| 101 | } |
|
| 102 | } |
|