Chris@0
|
1 <?php
|
Chris@0
|
2 /*
|
Chris@0
|
3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
Chris@0
|
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
Chris@0
|
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
Chris@0
|
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
Chris@0
|
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
Chris@0
|
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
Chris@0
|
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
Chris@0
|
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
Chris@0
|
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
Chris@0
|
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
Chris@0
|
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Chris@0
|
14 *
|
Chris@0
|
15 * This software consists of voluntary contributions made by many individuals
|
Chris@0
|
16 * and is licensed under the MIT license. For more information, see
|
Chris@0
|
17 * <http://www.doctrine-project.org>.
|
Chris@0
|
18 */
|
Chris@0
|
19
|
Chris@0
|
20 namespace Doctrine\Common\Persistence;
|
Chris@0
|
21
|
Chris@0
|
22 use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * Makes a Persistent Objects aware of its own object-manager.
|
Chris@0
|
26 *
|
Chris@0
|
27 * Using this interface the managing object manager and class metadata instances
|
Chris@0
|
28 * are injected into the persistent object after construction. This allows
|
Chris@0
|
29 * you to implement ActiveRecord functionality on top of the persistence-ignorance
|
Chris@0
|
30 * that Doctrine propagates.
|
Chris@0
|
31 *
|
Chris@0
|
32 * Word of Warning: This is a very powerful hook to change how you can work with your domain models.
|
Chris@0
|
33 * Using this hook will break the Single Responsibility Principle inside your Domain Objects
|
Chris@0
|
34 * and increase the coupling of database and objects.
|
Chris@0
|
35 *
|
Chris@0
|
36 * Every ObjectManager has to implement this functionality itself.
|
Chris@0
|
37 *
|
Chris@0
|
38 * @author Benjamin Eberlei <kontakt@beberlei.de>
|
Chris@0
|
39 */
|
Chris@0
|
40 interface ObjectManagerAware
|
Chris@0
|
41 {
|
Chris@0
|
42 /**
|
Chris@0
|
43 * Injects responsible ObjectManager and the ClassMetadata into this persistent object.
|
Chris@0
|
44 *
|
Chris@0
|
45 * @param ObjectManager $objectManager
|
Chris@0
|
46 * @param ClassMetadata $classMetadata
|
Chris@0
|
47 *
|
Chris@0
|
48 * @return void
|
Chris@0
|
49 */
|
Chris@0
|
50 public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata);
|
Chris@0
|
51 }
|