forked from K-Phoen/rulerz
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEloquentVisitor.php
More file actions
40 lines (33 loc) · 935 Bytes
/
EloquentVisitor.php
File metadata and controls
40 lines (33 loc) · 935 Bytes
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
<?php
namespace RulerZ\Target\Eloquent;
use Hoa\Ruler\Model as AST;
use RulerZ\Compiler\Context;
use RulerZ\Target\GenericSqlVisitor;
use RulerZ\Target\Operators\Definitions as OperatorsDefinitions;
class EloquentVisitor extends GenericSqlVisitor
{
/**
* Allow eloquent builder as query.
*
* @var bool
*/
protected $allowEloquentBuilderAsQuery = false;
public function __construct(
Context $context,
OperatorsDefinitions $operators,
$allowStarOperator = true,
$allowEloquentBuilderAsQuery = false
) {
parent::__construct($context, $operators, $allowStarOperator);
$this->allowEloquentBuilderAsQuery = (bool) $allowEloquentBuilderAsQuery;
}
/**
* @inheritDoc
*/
public function getCompilationData()
{
return [
'allowEloquentBuilderAsQuery ' => $this->allowEloquentBuilderAsQuery,
];
}
}