1 | <?php |
||
22 | abstract class AbstractFileDriver implements DriverInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var FileLocatorInterface |
||
26 | */ |
||
27 | protected $locator; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $classCache; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $fileName; |
||
38 | |||
39 | /** |
||
40 | * AbstractFileDriver constructor. |
||
41 | * |
||
42 | * @param FileLocatorInterface $locator |
||
43 | */ |
||
44 | public function __construct(FileLocatorInterface $locator) |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function loadMetadataForClass($className) |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function getAllClassNames() |
||
71 | |||
72 | /** |
||
73 | * Gets the element of schema meta data for the class from the mapping file. |
||
74 | * This will lazily load the mapping file if it is not loaded yet. |
||
75 | * |
||
76 | * @param string $className |
||
77 | * @param string $file |
||
78 | * |
||
79 | * @return mixed |
||
80 | * |
||
81 | * @throws MappingException |
||
82 | */ |
||
83 | public function getElement($className, $file) |
||
98 | |||
99 | /** |
||
100 | * Parses the content of the file, and converts it to the desired metadata. |
||
101 | * |
||
102 | * @param string $className |
||
103 | * @param string $file |
||
104 | * |
||
105 | * @return ClassMetadataInterface |
||
106 | */ |
||
107 | abstract protected function loadMetadataFromFile($className, $file); |
||
108 | |||
109 | /** |
||
110 | * Returns the extension of the file. |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | abstract protected function getExtension(); |
||
115 | |||
116 | /** |
||
117 | * Loads a mapping file with the given name and returns a map |
||
118 | * from class/entity names to their corresponding file driver elements. |
||
119 | * |
||
120 | * @param string $file The mapping file to load. |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | abstract protected function loadMappingFile($file); |
||
125 | } |
||
126 |