payer-view.php
2 years ago
payment-by-record.php
2 years ago
payment-count-view.php
2 years ago
payment-for-export-view.php
2 years ago
payment-view.php
2 years ago
payment-with-record-view.php
2 years ago
payment-by-record.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Modules\Gateways\Query_Views; |
| 5 | |
| 6 | use Jet_Form_Builder\Db_Queries\Exceptions\Sql_Exception; |
| 7 | use Jet_Form_Builder\Db_Queries\Query_Builder; |
| 8 | use Jet_Form_Builder\Db_Queries\Views\View_Base; |
| 9 | use Jet_Form_Builder\Exceptions\Query_Builder_Exception; |
| 10 | use JFB_Modules\Gateways\Db_Models\Payment_Model; |
| 11 | use JFB_Modules\Gateways\Db_Models\Payment_To_Record; |
| 12 | |
| 13 | // If this file is called directly, abort. |
| 14 | if ( ! defined( 'WPINC' ) ) { |
| 15 | die; |
| 16 | } |
| 17 | |
| 18 | class Payment_By_Record extends View_Base { |
| 19 | |
| 20 | public function table(): string { |
| 21 | return Payment_To_Record::table(); |
| 22 | } |
| 23 | |
| 24 | public function select_columns(): array { |
| 25 | return Payment_Model::schema_columns(); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * @param Query_Builder $builder |
| 30 | */ |
| 31 | public function get_prepared_join( Query_Builder $builder ) { |
| 32 | $payment_to_record = ( new Payment_To_Record() )->create()::table(); |
| 33 | $payments = Payment_Model::table(); |
| 34 | |
| 35 | $builder->join = " |
| 36 | LEFT JOIN `{$payments}` ON 1=1 |
| 37 | AND `{$payments}`.`id` = `{$payment_to_record}`.`payment_id` |
| 38 | "; |
| 39 | } |
| 40 | } |
| 41 |