/** * @return string */ function __toString() { $b = new DocBuilder(); // Type (1:m, m:1, m:n, etc..) $b->append($this->type); // Entity and variable (Entity::$variable) if ($this->variable) { $b->str(ucfirst($this->entity)); $b->str('::'); $b->append('$' . $this->variable); } else { $b->append(ucfirst($this->entity)); } // Primary if ($this->primary) { $b->append('primary'); } // Order (order:*property*) if ($this->orderProperty) { $b->append('order:' . $this->orderProperty); } // Ordering (DESC/ASC) if ($this->orderDirection) { $b->append($this->orderDirection === self::ASC ? 'ASC' : 'DESC'); } return (string) $b; }