@@ -23,7 +23,7 @@ class Selection implements \Iterator, IRowContainer, \ArrayAccess, \Countable
23
23
use Nette \SmartObject;
24
24
25
25
/** @var Explorer */
26
- protected $ context ;
26
+ protected $ explorer ;
27
27
28
28
/** @var IConventions */
29
29
protected $ conventions ;
@@ -89,7 +89,7 @@ public function __construct(
89
89
string $ tableName ,
90
90
Nette \Caching \IStorage $ cacheStorage = null
91
91
) {
92
- $ this ->context = $ explorer ;
92
+ $ this ->explorer = $ explorer ;
93
93
$ this ->conventions = $ conventions ;
94
94
$ this ->name = $ tableName ;
95
95
@@ -135,7 +135,7 @@ public function getPrimary(bool $throw = true)
135
135
public function getPrimarySequence (): ?string
136
136
{
137
137
if ($ this ->primarySequence === false ) {
138
- $ this ->primarySequence = $ this ->context ->getStructure ()->getPrimaryKeySequence ($ this ->name );
138
+ $ this ->primarySequence = $ this ->explorer ->getStructure ()->getPrimaryKeySequence ($ this ->name );
139
139
}
140
140
141
141
return $ this ->primarySequence ;
@@ -579,19 +579,19 @@ protected function createRow(array $row): ActiveRow
579
579
580
580
public function createSelectionInstance (string $ table = null ): self
581
581
{
582
- return new self ($ this ->context , $ this ->conventions , $ table ?: $ this ->name , $ this ->cache ? $ this ->cache ->getStorage () : null );
582
+ return new self ($ this ->explorer , $ this ->conventions , $ table ?: $ this ->name , $ this ->cache ? $ this ->cache ->getStorage () : null );
583
583
}
584
584
585
585
586
586
protected function createGroupedSelectionInstance (string $ table , string $ column ): GroupedSelection
587
587
{
588
- return new GroupedSelection ($ this ->context , $ this ->conventions , $ table , $ column , $ this , $ this ->cache ? $ this ->cache ->getStorage () : null );
588
+ return new GroupedSelection ($ this ->explorer , $ this ->conventions , $ table , $ column , $ this , $ this ->cache ? $ this ->cache ->getStorage () : null );
589
589
}
590
590
591
591
592
592
protected function query (string $ query ): Nette \Database \ResultSet
593
593
{
594
- return $ this ->context ->queryArgs ($ query , $ this ->sqlBuilder ->getParameters ());
594
+ return $ this ->explorer ->queryArgs ($ query , $ this ->sqlBuilder ->getParameters ());
595
595
}
596
596
597
597
@@ -796,16 +796,16 @@ public function insert(iterable $data)
796
796
{
797
797
//should be called before query for not to spoil PDO::lastInsertId
798
798
$ primarySequenceName = $ this ->getPrimarySequence ();
799
- $ primaryAutoincrementKey = $ this ->context ->getStructure ()->getPrimaryAutoincrementKey ($ this ->name );
799
+ $ primaryAutoincrementKey = $ this ->explorer ->getStructure ()->getPrimaryAutoincrementKey ($ this ->name );
800
800
801
801
if ($ data instanceof self) {
802
- $ return = $ this ->context ->queryArgs ($ this ->sqlBuilder ->buildInsertQuery () . ' ' . $ data ->getSql (), $ data ->getSqlBuilder ()->getParameters ());
802
+ $ return = $ this ->explorer ->queryArgs ($ this ->sqlBuilder ->buildInsertQuery () . ' ' . $ data ->getSql (), $ data ->getSqlBuilder ()->getParameters ());
803
803
804
804
} else {
805
805
if ($ data instanceof \Traversable) {
806
806
$ data = iterator_to_array ($ data );
807
807
}
808
- $ return = $ this ->context ->query ($ this ->sqlBuilder ->buildInsertQuery () . ' ?values ' , $ data );
808
+ $ return = $ this ->explorer ->query ($ this ->sqlBuilder ->buildInsertQuery () . ' ?values ' , $ data );
809
809
}
810
810
811
811
$ this ->loadRefCache ();
@@ -824,11 +824,11 @@ public function insert(iterable $data)
824
824
825
825
// First check sequence
826
826
if (!empty ($ primarySequenceName ) && $ primaryAutoincrementKey ) {
827
- $ primaryKey [$ primaryAutoincrementKey ] = $ this ->context ->getInsertId ($ this ->context ->getConnection ()->getSupplementalDriver ()->delimite ($ primarySequenceName ));
827
+ $ primaryKey [$ primaryAutoincrementKey ] = $ this ->explorer ->getInsertId ($ this ->explorer ->getConnection ()->getSupplementalDriver ()->delimite ($ primarySequenceName ));
828
828
829
829
// Autoincrement primary without sequence
830
830
} elseif ($ primaryAutoincrementKey ) {
831
- $ primaryKey [$ primaryAutoincrementKey ] = $ this ->context ->getInsertId ($ primarySequenceName );
831
+ $ primaryKey [$ primaryAutoincrementKey ] = $ this ->explorer ->getInsertId ($ primarySequenceName );
832
832
833
833
// Multi column primary without autoincrement
834
834
} elseif (is_array ($ this ->primary )) {
@@ -885,7 +885,7 @@ public function update(iterable $data): int
885
885
return 0 ;
886
886
}
887
887
888
- return $ this ->context ->queryArgs (
888
+ return $ this ->explorer ->queryArgs (
889
889
$ this ->sqlBuilder ->buildUpdateQuery (),
890
890
array_merge ([$ data ], $ this ->sqlBuilder ->getParameters ())
891
891
)->getRowCount ();
0 commit comments