Skip to content

Commit

Permalink
Merge branch 'DDC-1247'
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Feb 3, 2014
2 parents 2cb32a6 + 5892691 commit d0c1a60
Showing 1 changed file with 36 additions and 1 deletion.
Expand Up @@ -48,6 +48,13 @@ abstract class AnnotationDriver implements MappingDriver
*/
protected $paths = array();

/**
* The paths excluded from path where to look for mapping files.
*
* @var array
*/
protected $excludePaths = array();

/**
* The file extension of mapping documents.
*
Expand Down Expand Up @@ -107,7 +114,27 @@ public function getPaths()
}

/**
* Retrieves the current annotation reader.
* Append exclude lookup paths to metadata driver.
*
* @param array $paths
*/
public function addExcludePaths(array $paths)
{
$this->excludePaths = array_unique(array_merge($this->excludePaths, $paths));
}

/**
* Retrieve the defined metadata lookup exclude paths.
*
* @return array
*/
public function getExcludePaths()
{
return $this->excludePaths;
}

/**
* Retrieve the current annotation reader
*
* @return AnnotationReader
*/
Expand Down Expand Up @@ -194,6 +221,14 @@ public function getAllClassNames()
foreach ($iterator as $file) {
$sourceFile = realpath($file[0]);

foreach ($this->excludePaths as $excludePath) {
$exclude = str_replace('\\', '/', realpath($excludePath));
$current = str_replace('\\', '/', $sourceFile);
if (strpos($current, $exclude) !== false) {
continue 2;
}
}

require_once $sourceFile;

$includedFiles[] = $sourceFile;
Expand Down

0 comments on commit d0c1a60

Please sign in to comment.