Bug #30312

Entity class name is not properly detected in Repository::__construct()

Added by Bastian Waidelich almost 10 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
Persistence
Start date:
2011-09-27
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

If a package key contains the string "Repository", model class names are not correctly resolved in the Repository constructor because the line:

$this->entityClassName = str_replace(array('\\Repository\\', 'Repository'), array('\\Model\\', ''), get_class($this));

fails to detect the correct position of the substring and should be replaced by something like:
$this->entityClassName = preg_replace(array('/\\Repository\\/', '/Repository$/'), array('\\Model\\', ''), get_class($this));

See #30306

Also available in: Atom PDF