| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yatra\Core\Data; |
| 4 |
|
| 5 |
use Yatra\Core\Abstracts\TourParent; |
| 6 |
|
| 7 |
class TourData |
| 8 |
{ |
| 9 |
/* @var \Yatra\Core\Abstracts\TourParent $tourParent */ |
| 10 |
public function read($tourParent) |
| 11 |
{ |
| 12 |
$id = $tourParent->get_id(); |
| 13 |
|
| 14 |
$tourParent->set_name(get_the_title($id)); |
| 15 |
$tourParent->set_status(get_post_status($id)); |
| 16 |
$tourParent->set_type(get_post_meta($id, 'yatra_tour_meta_tour_type', true)); |
| 17 |
$disable_booking = get_post_meta($id, 'yatra_tour_meta_disable_booking', true); |
| 18 |
$is_featured = get_post_meta($id, 'yatra_tour_meta_tour_featured', true); |
| 19 |
$tourParent->set_is_featured((boolean)$is_featured); |
| 20 |
$can_book = !((boolean)$disable_booking === true); |
| 21 |
$tourParent->set_can_book($can_book); |
| 22 |
$is_fixed_departure = get_post_meta($id, 'yatra_tour_meta_tour_fixed_departure', true); |
| 23 |
$tourParent->set_is_fixed_departure((boolean)$is_fixed_departure); |
| 24 |
$tourParent->set_external_url(get_post_meta($id, 'yatra_tour_meta_tour_external_url', true)); |
| 25 |
$tourParent->set_book_now_text(get_post_meta($id, 'yatra_tour_meta_tour_external_button_text', true)); |
| 26 |
} |
| 27 |
} |