| @@ 19-84 (lines=66) @@ | ||
| 16 | * @author Brent Christensen |
|
| 17 | * @since $VID:$ |
|
| 18 | */ |
|
| 19 | class DatetimeTicketsConnection implements ConnectionInterface |
|
| 20 | { |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var EEM_Ticket $model |
|
| 24 | */ |
|
| 25 | protected $model; |
|
| 26 | ||
| 27 | ||
| 28 | /** |
|
| 29 | * DatetimeConnection constructor. |
|
| 30 | * |
|
| 31 | * @param EEM_Ticket $model |
|
| 32 | */ |
|
| 33 | public function __construct(EEM_Ticket $model) |
|
| 34 | { |
|
| 35 | $this->model = $model; |
|
| 36 | } |
|
| 37 | ||
| 38 | ||
| 39 | /** |
|
| 40 | * @return array |
|
| 41 | * @since $VID:$ |
|
| 42 | */ |
|
| 43 | public function config() |
|
| 44 | { |
|
| 45 | return [ |
|
| 46 | 'fromType' => 'Datetime', |
|
| 47 | 'toType' => 'Ticket', |
|
| 48 | 'fromFieldName' => 'tickets', |
|
| 49 | 'connectionTypeName' => 'DatetimeTicketsConnection', |
|
| 50 | 'resolve' => [$this, 'resolveConnection'], |
|
| 51 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | ||
| 55 | ||
| 56 | /** |
|
| 57 | * @param $entity |
|
| 58 | * @param $args |
|
| 59 | * @param $context |
|
| 60 | * @param $info |
|
| 61 | * @return array |
|
| 62 | * @throws Exception |
|
| 63 | * @since $VID:$ |
|
| 64 | */ |
|
| 65 | public function resolveConnection($entity, $args, $context, $info) |
|
| 66 | { |
|
| 67 | $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 68 | return $resolver->get_connection(); |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|
| 73 | * @param $id |
|
| 74 | * @param $args |
|
| 75 | * @param $context |
|
| 76 | * @param $info |
|
| 77 | * @return EE_Base_Class |
|
| 78 | * @since $VID:$ |
|
| 79 | */ |
|
| 80 | public function resolveNode($id, $args, $context, $info) |
|
| 81 | { |
|
| 82 | return $this->model->get_one_by_ID($id); |
|
| 83 | } |
|
| 84 | } |
|
| @@ 19-84 (lines=66) @@ | ||
| 16 | * @author Brent Christensen |
|
| 17 | * @since $VID:$ |
|
| 18 | */ |
|
| 19 | class EventDatetimesConnection implements ConnectionInterface |
|
| 20 | { |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var EEM_Datetime $model |
|
| 24 | */ |
|
| 25 | protected $model; |
|
| 26 | ||
| 27 | ||
| 28 | /** |
|
| 29 | * DatetimeConnection constructor. |
|
| 30 | * |
|
| 31 | * @param EEM_Datetime $model |
|
| 32 | */ |
|
| 33 | public function __construct(EEM_Datetime $model) |
|
| 34 | { |
|
| 35 | $this->model = $model; |
|
| 36 | } |
|
| 37 | ||
| 38 | ||
| 39 | /** |
|
| 40 | * @return array |
|
| 41 | * @since $VID:$ |
|
| 42 | */ |
|
| 43 | public function config() |
|
| 44 | { |
|
| 45 | return [ |
|
| 46 | 'fromType' => 'Event', |
|
| 47 | 'toType' => 'Datetime', |
|
| 48 | 'fromFieldName' => 'datetimes', |
|
| 49 | 'connectionTypeName' => 'EventDatetimesConnection', |
|
| 50 | 'resolve' => [$this, 'resolveConnection'], |
|
| 51 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | ||
| 55 | ||
| 56 | /** |
|
| 57 | * @param $entity |
|
| 58 | * @param $args |
|
| 59 | * @param $context |
|
| 60 | * @param $info |
|
| 61 | * @return array |
|
| 62 | * @throws Exception |
|
| 63 | * @since $VID:$ |
|
| 64 | */ |
|
| 65 | public function resolveConnection($entity, $args, $context, $info) |
|
| 66 | { |
|
| 67 | $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 68 | return $resolver->get_connection(); |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|
| 73 | * @param $id |
|
| 74 | * @param $args |
|
| 75 | * @param $context |
|
| 76 | * @param $info |
|
| 77 | * @return EE_Base_Class |
|
| 78 | * @since $VID:$ |
|
| 79 | */ |
|
| 80 | public function resolveNode($id, $args, $context, $info) |
|
| 81 | { |
|
| 82 | return $this->model->get_one_by_ID($id); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 19-84 (lines=66) @@ | ||
| 16 | * @author Brent Christensen |
|
| 17 | * @since $VID:$ |
|
| 18 | */ |
|
| 19 | class EventVenuesConnection implements ConnectionInterface |
|
| 20 | { |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var EEM_Venue $model |
|
| 24 | */ |
|
| 25 | protected $model; |
|
| 26 | ||
| 27 | ||
| 28 | /** |
|
| 29 | * DatetimeConnection constructor. |
|
| 30 | * |
|
| 31 | * @param EEM_Venue $model |
|
| 32 | */ |
|
| 33 | public function __construct(EEM_Venue $model) |
|
| 34 | { |
|
| 35 | $this->model = $model; |
|
| 36 | } |
|
| 37 | ||
| 38 | ||
| 39 | /** |
|
| 40 | * @return array |
|
| 41 | * @since $VID:$ |
|
| 42 | */ |
|
| 43 | public function config() |
|
| 44 | { |
|
| 45 | return [ |
|
| 46 | 'fromType' => 'Event', |
|
| 47 | 'toType' => 'Venue', |
|
| 48 | 'fromFieldName' => 'venues', |
|
| 49 | 'connectionTypeName' => 'EventVenuesConnection', |
|
| 50 | 'resolve' => [$this, 'resolveConnection'], |
|
| 51 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | ||
| 55 | ||
| 56 | /** |
|
| 57 | * @param $entity |
|
| 58 | * @param $args |
|
| 59 | * @param $context |
|
| 60 | * @param $info |
|
| 61 | * @return array |
|
| 62 | * @throws Exception |
|
| 63 | * @since $VID:$ |
|
| 64 | */ |
|
| 65 | public function resolveConnection($entity, $args, $context, $info) |
|
| 66 | { |
|
| 67 | $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
| 68 | return $resolver->get_connection(); |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|
| 73 | * @param $id |
|
| 74 | * @param $args |
|
| 75 | * @param $context |
|
| 76 | * @param $info |
|
| 77 | * @return EE_Base_Class |
|
| 78 | * @since $VID:$ |
|
| 79 | */ |
|
| 80 | public function resolveNode($id, $args, $context, $info) |
|
| 81 | { |
|
| 82 | return $this->model->get_one_by_ID($id); |
|
| 83 | } |
|
| 84 | } |
|
| @@ 19-84 (lines=66) @@ | ||
| 16 | * @author Brent Christensen |
|
| 17 | * @since $VID:$ |
|
| 18 | */ |
|
| 19 | class TicketDatetimesConnection implements ConnectionInterface |
|
| 20 | { |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var EEM_Datetime $model |
|
| 24 | */ |
|
| 25 | protected $model; |
|
| 26 | ||
| 27 | ||
| 28 | /** |
|
| 29 | * DatetimeConnection constructor. |
|
| 30 | * |
|
| 31 | * @param EEM_Datetime $model |
|
| 32 | */ |
|
| 33 | public function __construct(EEM_Datetime $model) |
|
| 34 | { |
|
| 35 | $this->model = $model; |
|
| 36 | } |
|
| 37 | ||
| 38 | ||
| 39 | /** |
|
| 40 | * @return array |
|
| 41 | * @since $VID:$ |
|
| 42 | */ |
|
| 43 | public function config() |
|
| 44 | { |
|
| 45 | return [ |
|
| 46 | 'fromType' => 'Ticket', |
|
| 47 | 'toType' => 'Datetime', |
|
| 48 | 'fromFieldName' => 'datetimes', |
|
| 49 | 'connectionTypeName' => 'TicketDatetimesConnection', |
|
| 50 | 'resolve' => [$this, 'resolveConnection'], |
|
| 51 | 'resolveNode' => [$this, 'resolveNode'] |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | ||
| 55 | ||
| 56 | /** |
|
| 57 | * @param $entity |
|
| 58 | * @param $args |
|
| 59 | * @param $context |
|
| 60 | * @param $info |
|
| 61 | * @return array |
|
| 62 | * @throws Exception |
|
| 63 | * @since $VID:$ |
|
| 64 | */ |
|
| 65 | public function resolveConnection($entity, $args, $context, $info) |
|
| 66 | { |
|
| 67 | $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 68 | return $resolver->get_connection(); |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|
| 73 | * @param $id |
|
| 74 | * @param $args |
|
| 75 | * @param $context |
|
| 76 | * @param $info |
|
| 77 | * @return EE_Base_Class |
|
| 78 | * @since $VID:$ |
|
| 79 | */ |
|
| 80 | public function resolveNode($id, $args, $context, $info) |
|
| 81 | { |
|
| 82 | return $this->model->get_one_by_ID($id); |
|
| 83 | } |
|
| 84 | } |
|