|
@@ 236-246 (lines=11) @@
|
| 233 |
|
* @throws InvalidArgumentException When a directory does not exist |
| 234 |
|
* @throws InvalidArgumentException When a directory has already been registered |
| 235 |
|
*/ |
| 236 |
|
public function addMetadataDir($dir, $namespacePrefix = '') |
| 237 |
|
{ |
| 238 |
|
if ( ! is_dir($dir)) { |
| 239 |
|
throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 240 |
|
} |
| 241 |
|
if (isset($this->metadataDirs[$namespacePrefix])) { |
| 242 |
|
throw new InvalidArgumentException(sprintf('There is already a directory configured for the namespace prefix "%s". Please use replaceMetadataDir() to override directories.', $namespacePrefix)); |
| 243 |
|
} |
| 244 |
|
$this->metadataDirs[$namespacePrefix] = $dir; |
| 245 |
|
return $this; |
| 246 |
|
} |
| 247 |
|
/** |
| 248 |
|
* Adds a map of namespace prefixes to directories. |
| 249 |
|
* |
|
@@ 272-282 (lines=11) @@
|
| 269 |
|
* @throws InvalidArgumentException When a directory does not exist |
| 270 |
|
* @throws InvalidArgumentException When no directory is configured for the ns prefix |
| 271 |
|
*/ |
| 272 |
|
public function replaceMetadataDir($dir, $namespacePrefix = '') |
| 273 |
|
{ |
| 274 |
|
if ( ! is_dir($dir)) { |
| 275 |
|
throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 276 |
|
} |
| 277 |
|
if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
| 278 |
|
throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
| 279 |
|
} |
| 280 |
|
$this->metadataDirs[$namespacePrefix] = $dir; |
| 281 |
|
return $this; |
| 282 |
|
} |
| 283 |
|
public function setMetadataDriverFactory(DriverFactoryInterface $driverFactory) |
| 284 |
|
{ |
| 285 |
|
$this->driverFactory = $driverFactory; |