3 final class PhabricatorDataNotAttachedException
extends Exception
{
5 public function __construct($object) {
6 $stack = debug_backtrace();
8 // Shift off `PhabricatorDataNotAttachedException::__construct()`.
10 // Shift off `PhabricatorLiskDAO::assertAttached()`.
13 $frame = head($stack);
15 if (is_array($frame)) {
16 $method = idx($frame, 'function');
17 if (preg_match('/^get[A-Z]/', $method)) {
18 $via = ' '.pht('(via %s)', "{$method}()");
24 "Attempting to access attached data on %s, but the data is not ".
25 "actually attached. Before accessing attachable data on an object, ".
26 "you must load and attach it.\n\n".
27 "Data is normally attached by calling the corresponding %s method on ".
28 "the Query class when the object is loaded. You can also call the ".
29 "corresponding %s method explicitly.",
30 get_class($object).$via,