Skip to content

Commit 21c18ea

Browse files
committed
More verbose error for same alias exception
1 parent 817bdad commit 21c18ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Mapping/Mapper.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ public function __construct(array $mappings = null)
3636
$mapping = $this->buildMapping($mappedClass);
3737

3838
if (false === empty($this->aliasMap[$mapping->getClassAlias()])) {
39+
3940
throw new MappingException(
40-
'Class with the same name already present. Please add an alias or change an existing one.'
41+
sprintf(
42+
'Class with name \'%s\' already present, used by \'%s\'. Please add an alias for \'%s\' or change an existing one.',
43+
$mapping->getClassAlias(),
44+
$this->aliasMap[$mapping->getClassAlias()],
45+
$mapping->getClassName()
46+
)
4147
);
4248
}
4349

0 commit comments

Comments
 (0)