@@ -23,7 +23,7 @@ class Selection implements \Iterator, IRowContainer, \ArrayAccess, \Countable
2323 use Nette \SmartObject;
2424
2525 /** @var Explorer */
26- protected $ context ;
26+ protected $ explorer ;
2727
2828 /** @var IConventions */
2929 protected $ conventions ;
@@ -89,7 +89,7 @@ public function __construct(
8989 string $ tableName ,
9090 Nette \Caching \IStorage $ cacheStorage = null
9191 ) {
92- $ this ->context = $ explorer ;
92+ $ this ->explorer = $ explorer ;
9393 $ this ->conventions = $ conventions ;
9494 $ this ->name = $ tableName ;
9595
@@ -135,7 +135,7 @@ public function getPrimary(bool $throw = true)
135135 public function getPrimarySequence (): ?string
136136 {
137137 if ($ this ->primarySequence === false ) {
138- $ this ->primarySequence = $ this ->context ->getStructure ()->getPrimaryKeySequence ($ this ->name );
138+ $ this ->primarySequence = $ this ->explorer ->getStructure ()->getPrimaryKeySequence ($ this ->name );
139139 }
140140
141141 return $ this ->primarySequence ;
@@ -579,19 +579,19 @@ protected function createRow(array $row): ActiveRow
579579
580580 public function createSelectionInstance (string $ table = null ): self
581581 {
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 );
583583 }
584584
585585
586586 protected function createGroupedSelectionInstance (string $ table , string $ column ): GroupedSelection
587587 {
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 );
589589 }
590590
591591
592592 protected function query (string $ query ): Nette \Database \ResultSet
593593 {
594- return $ this ->context ->queryArgs ($ query , $ this ->sqlBuilder ->getParameters ());
594+ return $ this ->explorer ->queryArgs ($ query , $ this ->sqlBuilder ->getParameters ());
595595 }
596596
597597
@@ -796,16 +796,16 @@ public function insert(iterable $data)
796796 {
797797 //should be called before query for not to spoil PDO::lastInsertId
798798 $ primarySequenceName = $ this ->getPrimarySequence ();
799- $ primaryAutoincrementKey = $ this ->context ->getStructure ()->getPrimaryAutoincrementKey ($ this ->name );
799+ $ primaryAutoincrementKey = $ this ->explorer ->getStructure ()->getPrimaryAutoincrementKey ($ this ->name );
800800
801801 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 ());
803803
804804 } else {
805805 if ($ data instanceof \Traversable) {
806806 $ data = iterator_to_array ($ data );
807807 }
808- $ return = $ this ->context ->query ($ this ->sqlBuilder ->buildInsertQuery () . ' ?values ' , $ data );
808+ $ return = $ this ->explorer ->query ($ this ->sqlBuilder ->buildInsertQuery () . ' ?values ' , $ data );
809809 }
810810
811811 $ this ->loadRefCache ();
@@ -824,11 +824,11 @@ public function insert(iterable $data)
824824
825825 // First check sequence
826826 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 ));
828828
829829 // Autoincrement primary without sequence
830830 } elseif ($ primaryAutoincrementKey ) {
831- $ primaryKey [$ primaryAutoincrementKey ] = $ this ->context ->getInsertId ($ primarySequenceName );
831+ $ primaryKey [$ primaryAutoincrementKey ] = $ this ->explorer ->getInsertId ($ primarySequenceName );
832832
833833 // Multi column primary without autoincrement
834834 } elseif (is_array ($ this ->primary )) {
@@ -885,7 +885,7 @@ public function update(iterable $data): int
885885 return 0 ;
886886 }
887887
888- return $ this ->context ->queryArgs (
888+ return $ this ->explorer ->queryArgs (
889889 $ this ->sqlBuilder ->buildUpdateQuery (),
890890 array_merge ([$ data ], $ this ->sqlBuilder ->getParameters ())
891891 )->getRowCount ();
0 commit comments