1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Service\Contracts;
6:
7: use LaravelUi5\OData\Edm\Contracts\Container\EntitySetInterface;
8: use LaravelUi5\OData\Edm\Contracts\Container\FunctionImportInterface;
9: use LaravelUi5\OData\Edm\Contracts\Container\SingletonInterface;
10: use LaravelUi5\OData\Edm\Contracts\EdmxInterface;
11:
12: /**
13: * The frozen runtime schema — an EdmxInterface paired with its resolver map.
14: *
15: * Produced by RuntimeSchemaBuilderInterface::build() and cached for the
16: * lifetime of the request. The Engine queries it to obtain the resolver for
17: * a given entity set; it never touches the schema again after query planning.
18: *
19: * The resolver map is keyed by EntitySetInterface object identity
20: * (spl_object_id). Since EdmxInterface is frozen, getEntitySet() always
21: * returns the same instance, making object identity a correct and stable key.
22: */
23: interface RuntimeSchemaInterface
24: {
25: /**
26: * The frozen Edm document this runtime schema was built from.
27: */
28: public function getEdmx(): EdmxInterface;
29:
30: /**
31: * Returns the resolver bound to the given entity set.
32: *
33: * The $set parameter must be the exact EntitySetInterface instance from
34: * this schema's EdmxInterface — not a different instance with the same
35: * name. Use getEdmx()->getEntityContainer()->getEntitySet($name) to
36: * obtain the canonical instance.
37: *
38: * @throws \RuntimeException if no resolver was bound for $set
39: */
40: public function getResolver(EntitySetInterface $set): EntitySetResolverInterface;
41:
42: /**
43: * Returns the resolver bound to the given function import.
44: *
45: * @throws \RuntimeException if no resolver was bound for $import
46: */
47: public function getFunctionResolver(FunctionImportInterface $import): FunctionResolverInterface;
48:
49: /**
50: * Returns the resolver bound to the given singleton.
51: *
52: * @throws \RuntimeException if no resolver was bound for $singleton
53: */
54: public function getSingletonResolver(SingletonInterface $singleton): SingletonResolverInterface;
55: }
56: