| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 22 | public function getNodeIdByTitle($title, $type) |
||
| 23 | { |
||
| 24 | $nid = db_select('node', 'n') |
||
| 25 | ->fields('n', array('nid')) |
||
| 26 | ->condition('n.title', $title) |
||
| 27 | ->condition('n.type', $type) |
||
| 28 | ->range(0, 1) |
||
| 29 | ->execute()->fetchField(); |
||
| 30 | |||
| 31 | if (empty($nid)) { |
||
| 32 | throw new \Exception(sprintf("Node %s of %s not found.", $title, $type)); |
||
| 33 | } |
||
| 34 | return $nid; |
||
| 35 | } |
||
| 36 | } |
||
| 37 |