[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/storage/lisk/ -> PhabricatorDataNotAttachedException.php (source)

   1  <?php
   2  
   3  final class PhabricatorDataNotAttachedException extends Exception {
   4  
   5    public function __construct($object) {
   6      $stack = debug_backtrace();
   7  
   8      // Shift off `PhabricatorDataNotAttachedException::__construct()`.
   9      array_shift($stack);
  10      // Shift off `PhabricatorLiskDAO::assertAttached()`.
  11      array_shift($stack);
  12  
  13      $frame = head($stack);
  14      $via = null;
  15      if (is_array($frame)) {
  16        $method = idx($frame, 'function');
  17        if (preg_match('/^get[A-Z]/', $method)) {
  18          $via = " (via {$method}())";
  19        }
  20      }
  21  
  22      $class = get_class($object);
  23  
  24      $message =
  25        "Attempting to access attached data on {$class}{$via}, but the data is ".
  26        "not actually attached. Before accessing attachable data on an object, ".
  27        "you must load and attach it.\n\n".
  28        "Data is normally attached by calling the corresponding needX() ".
  29        "method on the Query class when the object is loaded. You can also ".
  30        "call the corresponding attachX() method explicitly.";
  31  
  32      parent::__construct($message);
  33    }
  34  
  35  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1