Skip to content

Commit 23061d1

Browse files
committed
renamed parameter $need -> $throw
1 parent d9982b8 commit 23061d1

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/Database/Table/ActiveRow.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ public function toArray()
8282
* @param bool
8383
* @return mixed possible int, string, array, object (Nette\Utils\DateTime)
8484
*/
85-
public function getPrimary($need = TRUE)
85+
public function getPrimary($throw = TRUE)
8686
{
87-
$primary = $this->table->getPrimary($need);
87+
$primary = $this->table->getPrimary($throw);
8888
if ($primary === NULL) {
8989
return NULL;
9090

9191
} elseif (!is_array($primary)) {
9292
if (isset($this->data[$primary])) {
9393
return $this->data[$primary];
94-
} elseif ($need) {
94+
} elseif ($throw) {
9595
throw new Nette\InvalidStateException("Row does not contain primary $primary column data.");
9696
} else {
9797
return NULL;
@@ -101,7 +101,7 @@ public function getPrimary($need = TRUE)
101101
$primaryVal = [];
102102
foreach ($primary as $key) {
103103
if (!isset($this->data[$key])) {
104-
if ($need) {
104+
if ($throw) {
105105
throw new Nette\InvalidStateException("Row does not contain primary $key column data.");
106106
} else {
107107
return NULL;
@@ -119,9 +119,9 @@ public function getPrimary($need = TRUE)
119119
* @param bool
120120
* @return string
121121
*/
122-
public function getSignature($need = TRUE)
122+
public function getSignature($throw = TRUE)
123123
{
124-
return implode('|', (array) $this->getPrimary($need));
124+
return implode('|', (array) $this->getPrimary($throw));
125125
}
126126

127127

src/Database/Table/IRow.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ function getTable();
2828
* @param bool
2929
* @return mixed
3030
*/
31-
function getPrimary($need = TRUE);
31+
function getPrimary($throw = TRUE);
3232

3333
/**
3434
* Returns row signature (composition of primary keys)
3535
* @param bool
3636
* @return string
3737
*/
38-
function getSignature($need = TRUE);
38+
function getSignature($throw = TRUE);
3939

4040
/**
4141
* Returns referencing rows.

src/Database/Table/Selection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ public function getName()
123123
* @param bool
124124
* @return string|array|NULL
125125
*/
126-
public function getPrimary($need = TRUE)
126+
public function getPrimary($throw = TRUE)
127127
{
128-
if ($this->primary === NULL && $need) {
128+
if ($this->primary === NULL && $throw) {
129129
throw new \LogicException("Table '{$this->name}' does not have a primary key.");
130130
}
131131
return $this->primary;

0 commit comments

Comments
 (0)