| @@ 482-488 (lines=7) @@ | ||
| 479 | $qb = $this->get_uniquefield_query($parentclass, $field, $part, $parentfield, $up); |
|
| 480 | $qb->select("c.id"); |
|
| 481 | $up = intval($qb->getQuery()->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR)); |
|
| 482 | if ($up === 0) { |
|
| 483 | exception::not_exists(); |
|
| 484 | $this->id = 0; |
|
| 485 | $this->set_guid(''); |
|
| 486 | return false; |
|
| 487 | } |
|
| 488 | } |
|
| 489 | ||
| 490 | $qb = $this->get_uniquefield_query(get_class($this), $field, $name, $upfield, $up); |
|
| 491 | $qb->select("c"); |
|
| @@ 495-501 (lines=7) @@ | ||
| 492 | ||
| 493 | $entity = $qb->getQuery()->getOneOrNullResult(); |
|
| 494 | ||
| 495 | if ($entity === null) { |
|
| 496 | exception::not_exists(); |
|
| 497 | $this->id = 0; |
|
| 498 | $this->set_guid(''); |
|
| 499 | return false; |
|
| 500 | } |
|
| 501 | $this->populate_from_entity($entity); |
|
| 502 | ||
| 503 | return true; |
|
| 504 | } |
|