Skip to content

Commit

Permalink
GH-139 Create union join data fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Dec 10, 2020
1 parent 0438c8a commit febd7f2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/flightControl/_includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$includePath = $_EnginePath . 'modules/flightControl/';

include($includePath . './utils/helpers/getAvailableSpeeds.helper.php');
include($includePath . './utils/helpers/getFleetUnionJoinData.helper.php');
include($includePath . './utils/validators/fleetArray.validator.php');

});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace UniEngine\Engine\Modules\FlightControl\Utils\Helpers;

/**
* @param array $props
* @param array $props['newFleet']
*/
function getFleetUnionJoinData ($props) {
$newFleet = $props['newFleet'];

$fetchUnionDataQuery = (
"SELECT " .
"{{table}}.*, `fleets`.`fleet_send_time` AS `mf_start_time` " .
"FROM {{table}} " .
"LEFT JOIN {{prefix}}fleets AS `fleets` " .
"ON " .
"`fleets`.`fleet_id` = {{table}}.`main_fleet_id` " .
"WHERE " .
"{{table}}.`id` = {$newFleet['ACS_ID']} " .
"LIMIT 1 " .
";"
);
$fetchUnionDataResult = doquery($fetchUnionDataQuery, 'acs', true);

return $fetchUnionDataResult;
}

?>

0 comments on commit febd7f2

Please sign in to comment.