, , , false , .
, , PHP ( , ). : , Product::getById($id). , , , . , . . :
- (
Product::getByIdWithoutException()) - (
Product::getAllIds(array $ids)). , ( ..).
, , , , , . true , , , . , , :
function getById($id, $throwException = true) {
if (!self::idExists($id)) {
if ($throwException) {
throw new IdNotFoundException();
} else {
return NULL;
}
}
return self::getByWhereClause('id = ' . self::escape($id), $throwException);
}
, .