1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\DataDefinition\Definition;
14:
15: use DcGeneral\DataDefinition\ModelRelationship\ParentChildConditionInterface;
16: use DcGeneral\DataDefinition\ModelRelationship\RootConditionInterface;
17:
18: /**
19: * This interface describes the relationships between data providers.
20: *
21: * It holds a root condition for the root data provider and many parent child relationships.
22: *
23: * @package DcGeneral\DataDefinition\Definition
24: */
25: interface ModelRelationshipDefinitionInterface extends DefinitionInterface
26: {
27: /**
28: * The name of the definition.
29: */
30: const NAME = 'model-relationships';
31:
32: /**
33: * Set the root condition for the current table.
34: *
35: * @param RootConditionInterface $condition The root condition.
36: *
37: * @return ModelRelationshipDefinitionInterface
38: */
39: public function setRootCondition($condition);
40:
41: /**
42: * Retrieve the root condition for the current table.
43: *
44: * @return RootConditionInterface
45: */
46: public function getRootCondition();
47:
48: /**
49: * Add a parent child condition.
50: *
51: * @param ParentChildConditionInterface $condition The parent child condition.
52: *
53: * @return ModelRelationshipDefinitionInterface
54: */
55: public function addChildCondition($condition);
56:
57: /**
58: * Retrieve the parent child condition for the current table.
59: *
60: * @param string $srcProvider The parenting table.
61: *
62: * @param string $dstProvider The child table.
63: *
64: * @return ParentChildConditionInterface
65: */
66: public function getChildCondition($srcProvider, $dstProvider);
67:
68: /**
69: * Retrieve the parent child conditions for the current table.
70: *
71: * @param string $srcProvider The parenting table for which child conditions shall be assembled for (optional).
72: *
73: * @return ParentChildConditionInterface[]
74: */
75: public function getChildConditions($srcProvider = '');
76: }
77: