Proxy.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\Common\Proxy;
  20. use Doctrine\Common\Persistence\Proxy as BaseProxy;
  21. use Closure;
  22. /**
  23. * Interface for proxy classes.
  24. *
  25. * @author Roman Borschel <roman@code-factory.org>
  26. * @author Marco Pivetta <ocramius@gmail.com>
  27. * @since 2.4
  28. */
  29. interface Proxy extends BaseProxy
  30. {
  31. /**
  32. * Marks the proxy as initialized or not.
  33. *
  34. * @param boolean $initialized
  35. *
  36. * @return void
  37. */
  38. public function __setInitialized($initialized);
  39. /**
  40. * Sets the initializer callback to be used when initializing the proxy. That
  41. * initializer should accept 3 parameters: $proxy, $method and $params. Those
  42. * are respectively the proxy object that is being initialized, the method name
  43. * that triggered initialization and the parameters passed to that method.
  44. *
  45. * @param Closure|null $initializer
  46. *
  47. * @return void
  48. */
  49. public function __setInitializer(Closure $initializer = null);
  50. /**
  51. * Retrieves the initializer callback used to initialize the proxy.
  52. *
  53. * @see __setInitializer
  54. *
  55. * @return Closure|null
  56. */
  57. public function __getInitializer();
  58. /**
  59. * Sets the callback to be used when cloning the proxy. That initializer should accept
  60. * a single parameter, which is the cloned proxy instance itself.
  61. *
  62. * @param Closure|null $cloner
  63. *
  64. * @return void
  65. */
  66. public function __setCloner(Closure $cloner = null);
  67. /**
  68. * Retrieves the callback to be used when cloning the proxy.
  69. *
  70. * @see __setCloner
  71. *
  72. * @return Closure|null
  73. */
  74. public function __getCloner();
  75. /**
  76. * Retrieves the list of lazy loaded properties for a given proxy
  77. *
  78. * @return array Keys are the property names, and values are the default values
  79. * for those properties.
  80. */
  81. public function __getLazyProperties();
  82. }