File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ public function offsetUnset($offset) : void
108108 */
109109 public function refresh () : void
110110 {
111- $ this ->row = $ this ->row ->getTable ()->get ($ this ->primaryKey ->getValue ());
111+ $ this ->row = $ this ->row ->getTable ()->createSelectionInstance ( $ this -> getTableName ())-> get ($ this ->primaryKey ->getValue ());
112112 $ this ->initiateProperties ();
113113 }
114114
Original file line number Diff line number Diff line change 66
77final class Connection extends \Nette \Database \Connection
88{
9- public function query ( string $ sql , ... $ params ): \ Nette \ Database \ ResultSet
9+ public function connect () : void
1010 {
1111 try {
12- return parent ::query ($ sql , $ params );
12+ parent ::connect ();
13+ } catch (\PDOException $ e ) {
14+ if (\str_contains ($ e ->getMessage (), 'reset by peer ' )) {
15+ parent ::connect (); // retry
16+
17+ return ;
18+ }
19+
20+ throw $ e ;
21+ }
22+ }
23+
24+ public function query (string $ sql , ...$ params ) : \Nette \Database \ResultSet
25+ {
26+ try {
27+ return parent ::query ($ sql , ...$ params );
1328 } catch (\PDOException $ e ) {
1429 if ($ e ->getCode () === 'HY000 ' && \str_contains ($ e ->getMessage (), 'gone away ' )) {
1530 $ this ->reconnect ();
1631
17- return parent ::query ($ sql , $ params ); // retry
32+ return parent ::query ($ sql , ... $ params ); // retry
1833 }
1934
2035 throw $ e ;
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ public function count() : int
146146 /**
147147 * Clones object - same as: $copy = clone $orig;
148148 */
149- public function clone () : self
149+ public function clone () : static
150150 {
151151 $ newSel = clone $ this ->selection ;
152152
You can’t perform that action at this time.
0 commit comments