public function __construct(Xref $xref, $message = "", $code = 0, \Exception $previous = null)
 {
     if ($xref->hasLocation()) {
         $message = sprintf("Error resolving Xref of type \"%s\" from location \"%s\"%s", $xref->getType(), $xref->getLocation(), $message == '' ? '' : ': ' . $message);
     }
     parent::__construct($message, $code, $previous);
 }
 public function __construct(Xref $xref, $message = "", $code = 0, \Exception $previous = null)
 {
     if ($xref->hasLocation()) {
         $message = sprintf('Unable to fetch external reference of type "%s" from location "%s"%s.', $xref->getType(), $xref->getLocation(), $message == '' ? '' : ': ' . $message);
     } else {
         $message = sprintf('Unable to fetch external reference of type "%s": no location specified.', $xref->getType());
     }
     parent::__construct($message, $code, $previous);
 }
Beispiel #3
0
 public function remove(Xref $xref)
 {
     try {
         $this->removeById($xref->getId());
     } catch (\Exception $e) {
         if (strpos($e->getMessage(), $xref->getId())) {
             throw new \Exception(sprintf('Xref of type "%s" with location "%s" not in collection.', $xref->getType(), $xref->getLocation()));
         }
         throw $e;
     }
 }