|
@@ 74-81 (lines=8) @@
|
| 71 |
|
* @return array $select The list of fields to select (defaults to SQL-like '*' - all the fields) |
| 72 |
|
* @return integer The matching record |
| 73 |
|
*/ |
| 74 |
|
public function findOne($moduleName, array $params, array $select = [ ]) |
| 75 |
|
{ |
| 76 |
|
$records = $this->findMany($moduleName, $params, $select, 1); |
| 77 |
|
if (false === $records || !isset($records[ 0 ])) { |
| 78 |
|
return false; |
| 79 |
|
} |
| 80 |
|
return $records[ 0 ]; |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
/** |
| 84 |
|
* Retrieves the ID of the entity matching a list of constraints + prepends '<module_id>x' string to it |
|
@@ 89-96 (lines=8) @@
|
| 86 |
|
* @param array $params Data used to find a matching entry |
| 87 |
|
* @return integer Type ID (a numeric ID + '<module_id>x') |
| 88 |
|
*/ |
| 89 |
|
public function getID($moduleName, array $params) |
| 90 |
|
{ |
| 91 |
|
$record = $this->findOne($moduleName, $params, [ 'id' ]); |
| 92 |
|
if (false === $record || !isset($record[ 'id' ]) || empty($record[ 'id' ])) { |
| 93 |
|
return false; |
| 94 |
|
} |
| 95 |
|
return $record[ 'id' ]; |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
/** |
| 99 |
|
* Retrieve a numeric ID of the entity matching a list of constraints |