-
Notifications
You must be signed in to change notification settings - Fork 0
/
ForDelete.php
45 lines (45 loc) · 1.33 KB
/
ForDelete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
///**
// * Created by PhpStorm.
// * User: Algeneral
// * Date: 7/12/2018
// * Time: 1:58 PM
// */
// function join($firstTable, $secondTable, $firstKey, $secondKey)
//{
// $firstTableData = self::FetchAllData($firstTable);
// $ids = [];
// foreach ($firstTableData as $datum) {
// $ids[] = $datum[$firstKey];
// }
// $ids = implode(', ', $ids);
// $secondTableData = self::FetchAllData($secondTable, $secondKey . ' in(' . $ids . ')');
//
// foreach ($firstTableData as $key => $v) {
// $joinedTableId = array_search($v['lang'], $secondTableData);
// $id = self::searchForIndex($secondTableData, 'id', $v['lang']);
// $firstTableData[$key][$secondTable . "_data"] = $secondTableData[$id];
// }
//
// dd($firstTableData);
//}
//
//function searchForIndex($array, $arrayKey, $val)
//{
// foreach ($array as $key => $item) {
// if ($item[$arrayKey] == $val)
// return $key;
// }
//}
//
//public static function join($tables, $keys)
//{
// $firstTableData = self::FetchAllData($tables[0]);
// unset($tables[0]);
// foreach ($firstTableData as $k => $v) {
// foreach ($tables as $k2 => $table) {
// $firstTableData[$k][$table . '_data'] = self::FetchAllData($table, $keys[$k2] . "=" . $v[$keys[0]]);
// }
// }
// dd($firstTableData);
//}