ExtendableInterface.php 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Drupal\Core\Database\Query;
  3. /**
  4. * Interface for extendable query objects.
  5. *
  6. * "Extenders" follow the "Decorator" OOP design pattern. That is, they wrap
  7. * and "decorate" another object. In our case, they implement the same
  8. * interface as select queries and wrap a select query, to which they delegate
  9. * almost all operations. Subclasses of this class may implement additional
  10. * methods or override existing methods as appropriate. Extenders may also wrap
  11. * other extender objects, allowing for arbitrarily complex "enhanced" queries.
  12. */
  13. interface ExtendableInterface {
  14. /**
  15. * Enhance this object by wrapping it in an extender object.
  16. *
  17. * @param $extender_name
  18. * The fully-qualified name of the extender class, without the leading '\'
  19. * (for example, Drupal\my_module\myExtenderClass). The extender name will
  20. * be checked against the current database connection to allow
  21. * driver-specific subclasses as well, using the same logic as the query
  22. * objects themselves.
  23. *
  24. * @return \Drupal\Core\Database\Query\ExtendableInterface
  25. * The extender object, which now contains a reference to this object.
  26. */
  27. public function extend($extender_name);
  28. }