| @@ 470-476 (lines=7) @@ | ||
| 467 | $qb = $this->get_uniquefield_query($parentclass, $field, $part, $parentfield, $up); |
|
| 468 | $qb->select("c.id"); |
|
| 469 | $up = intval($qb->getQuery()->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR)); |
|
| 470 | if ($up === 0) { |
|
| 471 | exception::not_exists(); |
|
| 472 | $this->id = 0; |
|
| 473 | $this->set_guid(''); |
|
| 474 | return false; |
|
| 475 | } |
|
| 476 | } |
|
| 477 | ||
| 478 | $qb = $this->get_uniquefield_query(get_class($this), $field, $name, $upfield, $up); |
|
| 479 | $qb->select("c"); |
|
| @@ 483-489 (lines=7) @@ | ||
| 480 | ||
| 481 | $entity = $qb->getQuery()->getOneOrNullResult(); |
|
| 482 | ||
| 483 | if ($entity === null) { |
|
| 484 | exception::not_exists(); |
|
| 485 | $this->id = 0; |
|
| 486 | $this->set_guid(''); |
|
| 487 | return false; |
|
| 488 | } |
|
| 489 | $this->populate_from_entity($entity); |
|
| 490 | ||
| 491 | return true; |
|
| 492 | } |
|