| @@ 461-467 (lines=7) @@ | ||
| 458 | $qb = $this->get_uniquefield_query($parentclass, $field, $part, $parentfield, $up); |
|
| 459 | $qb->select("c.id"); |
|
| 460 | $up = intval($qb->getQuery()->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR)); |
|
| 461 | if ($up === 0) { |
|
| 462 | exception::not_exists(); |
|
| 463 | $this->id = 0; |
|
| 464 | $this->set_guid(''); |
|
| 465 | return false; |
|
| 466 | } |
|
| 467 | } |
|
| 468 | ||
| 469 | $qb = $this->get_uniquefield_query(get_class($this), $field, $name, $upfield, $up); |
|
| 470 | $qb->select("c"); |
|
| @@ 474-480 (lines=7) @@ | ||
| 471 | ||
| 472 | $entity = $qb->getQuery()->getOneOrNullResult(); |
|
| 473 | ||
| 474 | if ($entity === null) { |
|
| 475 | exception::not_exists(); |
|
| 476 | $this->id = 0; |
|
| 477 | $this->set_guid(''); |
|
| 478 | return false; |
|
| 479 | } |
|
| 480 | $this->populate_from_entity($entity); |
|
| 481 | ||
| 482 | return true; |
|
| 483 | } |
|