private function checkMethodArgumentsCount($expectedCount, array $arguments, $methodName)
{
if (count($arguments) !== $expectedCount) {
if ($expectedCount === 0) {
throw new InvalidMethodCallException("Method '{$methodName}' in entity " . get_called_class() . " doesn't expect any arguments.");
} else {
throw new InvalidMethodCallException("Method '{$methodName}' in entity " . get_called_class() . " expects exactly {$expectedCount} argument" . ($expectedCount > 1 ? 's' : '') . '.');
}
}
}