Skip to content

Commit 823efa3

Browse files
committed
wip
1 parent bc4dff7 commit 823efa3

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

src/Classes/BaseHelper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public function setTables($tables)
153153
if (is_array($tables)) {
154154
$this->tables = array_merge($this->tables, $tables);
155155
}
156+
156157
// if the parameter is string, then push this table name to the tables property.
157158
if (is_string($tables)) {
158159
array_push($this->tables, $tables);
@@ -307,11 +308,13 @@ public function executeAll($callback = null)
307308
if (isset($callback)) {
308309
return $callback($this->getQuery());
309310
}
311+
310312
// check if we are now in selection status
311313
// so we will execute this selection query.
312314
if ($this->isSelectStatus()) {
313315
return DB::select(DB::raw($this->getQuery()));
314316
}
317+
315318
// if we are not, then execute what evere this statement.
316319
DB::statement($this->getQuery());
317320

@@ -323,7 +326,7 @@ public function executeAll($callback = null)
323326

324327
/**
325328
* clear all inserted data in class properties.
326-
* this function igore the savedDataItems property,
329+
* this function ignore the savedDataItems property,
327330
* because this package designed to be a strong declarative concept,
328331
* and we want a node to store all the work on.
329332
*

src/Classes/DeleteHelper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ class DeleteHelper extends BaseHelper
2424
public function dropMultiTables()
2525
{
2626
$tables = $this->tables;
27+
2728
$query = "";
29+
2830
foreach ($tables as $index => $table) {
2931
$query .= $index == 0 ? "`$table`" : ",`$table`";
3032
}
33+
3134
$this->setQuery(sprintf("DROP TABLE %s;", $query));
3235

3336
return $this;

src/Classes/JoinHelper.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function buildJoin($saveItems = true)
7575
$this->getTableName(),
7676
$this->getQuery()
7777
));
78+
7879
// change the selection status to isSelectStatus,
7980
// so we can execute this query as a raw statement.
8081
$this->setIsSelectStatus();
@@ -119,11 +120,14 @@ public function resolveRelation($firstTable, $secondTable)
119120
public function fastJoin($mainTableName, $selection, $tables, $joinTypes = 'JOIN')
120121
{
121122
$tables = !is_array($tables) ? [$tables] : $tables;
123+
122124
// this is a important step if the user has been execute multi fastJoin
123125
// because the clearAll function clear the default field.
124126
$this->setField('id');
127+
125128
// build the join query
126129
$this->buildFastJoin($mainTableName, $selection, $tables, $joinTypes);
130+
127131
// clear all parameter's, except the saved items.
128132
$this->clearAll();
129133

@@ -137,6 +141,7 @@ public function fastJoin($mainTableName, $selection, $tables, $joinTypes = 'JOIN
137141
*
138142
* @return JoinHelper
139143
* @author karam mustafa
144+
*
140145
* @example if we have main table that inserted by the setTableName function
141146
* and lets say that table is users
142147
* and we want to add join with posts table
@@ -177,8 +182,10 @@ public function addJoin($table)
177182
private function buildFastJoin($mainTableName, $selection, $tables, $joinTypes): void
178183
{
179184
$this->loopThrough($tables, function ($index, $table) use ($joinTypes, $selection, $mainTableName) {
185+
180186
// set random key with custom convention for a saved item.
181187
$savedKey = $mainTableName.'_'.Str::random('4');
188+
182189
// push the query result on saved items property
183190
// this make us can handle multi query statement
184191
$this->setSavedItems([

src/Classes/UpdateHelper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function buildStatement()
9898
public function bindIdsWithValues()
9999
{
100100
$cases = [];
101+
101102
foreach ($this->getIds() as $index => $id) {
102103
$val = $this->checkIfInteger($index)
103104
// if the index is an integer, then we get the value.

0 commit comments

Comments
 (0)