| @@ 53-70 (lines=18) @@ | ||
| 50 | * @return mixed object if id exists, false if not |
|
| 51 | * @access public |
|
| 52 | */ |
|
| 53 | public function &get($id) |
|
| 54 | { |
|
| 55 | $id = (int)$id; |
|
| 56 | if ($id > 0) { |
|
| 57 | $sql = $this->_selectQuery(new Criteria($this->_idfield, $id)); |
|
| 58 | if (!$result = $this->_db->query($sql)) { |
|
| 59 | return false; |
|
| 60 | } |
|
| 61 | $numrows = $this->_db->getRowsNum($result); |
|
| 62 | if ($numrows == 1) { |
|
| 63 | $obj = new $this->classname($this->_db->fetchArray($result)); |
|
| 64 | ||
| 65 | return $obj; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| 69 | return false; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * retrieve objects from the database |
|
| @@ 89-106 (lines=18) @@ | ||
| 86 | * @return object {@link smartpartnerMimetype} |
|
| 87 | * @access public |
|
| 88 | */ |
|
| 89 | public function &get($id) |
|
| 90 | { |
|
| 91 | $id = (int)$id; |
|
| 92 | if ($id > 0) { |
|
| 93 | $sql = $this->_selectQuery(new Criteria('mime_id', $id)); |
|
| 94 | if (!$result = $this->_db->query($sql)) { |
|
| 95 | return false; |
|
| 96 | } |
|
| 97 | $numrows = $this->_db->getRowsNum($result); |
|
| 98 | if ($numrows == 1) { |
|
| 99 | $obj = new $this->classname($this->_db->fetchArray($result)); |
|
| 100 | ||
| 101 | return $obj; |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||
| 105 | return false; |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * retrieve objects from the database |
|