extension_builder icon indicating copy to clipboard operation
extension_builder copied to clipboard

🐛 [BUG] Renaming of model name is not possible.

Open DavidBruchmann opened this issue 3 years ago • 2 comments

Describe the bug Renaming of model name is not possible. An error message is shown, and I added a line for debug output to see what's happening, see it on the screenshot below.

To Reproduce Steps to reproduce the behavior:

  1. Create a model with the name "Entries", save the extension.
  2. Rename the model to "Entry", try to save again.
  3. See the error

Expected behavior It's expected that the changed model name is saved.

Screenshots image

TYPO3 Version 11.5.4

Extension Builder Version: TER version 11.0.1

DavidBruchmann avatar Dec 23 '21 16:12 DavidBruchmann

I could circumvent it by changing the method like this:

    protected function replaceUpperAndLowerCase(string $search, string $replace, $haystack): string
    {
        if (!is_array($haystack)) {
            $result = str_replace(ucfirst($search), ucfirst($replace), $haystack);
            return str_replace(lcfirst($search), lcfirst($replace), $result);
        } else {
            return '';
        }
    }

DavidBruchmann avatar Dec 25 '21 00:12 DavidBruchmann

Even with the provided code change, I get another error when renaming a model: Bildschirmfoto 2024-02-15 um 11 31 54

$injectMethod->getBodyStmts() returns an object, not an array or string.

PKuhlmay avatar Feb 15 '24 10:02 PKuhlmay