iuuujkl
iuuujkl

Reputation: 2384

TYPO3 8.7.16: class from extension is not available

I try to load own extensions via composer.json but when I run the application I always get this error:

#1411840171: The class "Bm\AhContentelements\Rendering\VideoTagRenderer" you are trying to register is not available

I load my ah contentelements extension in json as:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://composer.typo3.org/"
    },
    {
      "type": "package",
      "package": {
        "name": "Bm/ah-content-api",
        "version": "0.0.1",
        "type": "typo3-cms-extension",
        "source": {
          "url": "https://[email protected]/u/ah_config_typo3.git",
          "type": "git",
          "reference": "master"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "Bm/ah-contentelements",
        "version": "0.0.1",
        "type": "typo3-cms-extension",
        "source": {
          "url": "https://[email protected]/u/ah_contentelements_typo3.git",
          "type": "git",
          "reference": "master"
        }
      }
    }
  ],
  "name": "typo3/cms-base-distribution",
  "description": "TYPO3 CMS Base Distribution",
  "license": "GPL-2.0-or-later",
  "require": {
    "helhum/typo3-console": "^4.9.3 || ^5.2",
    "typo3/cms-about": "^8.7.10",
    "typo3/cms-belog": "^8.7.10",
    "typo3/cms-beuser": "^8.7.10",
    "typo3/cms-context-help": "^8.7.10",
    "typo3/cms-documentation": "^8.7.10",
    "typo3/cms-felogin": "^8.7.10",
    "typo3/cms-fluid-styled-content": "^8.7.10",
    "typo3/cms-form": "^8.7.10",
    "typo3/cms-func": "^8.7.10",
    "typo3/cms-impexp": "^8.7.10",
    "typo3/cms-info": "^8.7.10",
    "typo3/cms-info-pagetsconfig": "^8.7.10",
    "typo3/cms-rte-ckeditor": "^8.7.10",
    "typo3/cms-setup": "^8.7.10",
    "typo3/cms-sys-note": "^8.7.10",
    "typo3/cms-t3editor": "^8.7.10",
    "typo3/cms-tstemplate": "^8.7.10",
    "typo3/cms-viewpage": "^8.7.10",
    "typo3/cms-wizard-crpages": "^8.7.10",
    "typo3/cms-wizard-sortpages": "^8.7.10",
    "typo3/cms": "^8.7",
    "dmitryd/typo3-realurl": "2.*",
    "GridElementsTeam/Gridelements": "8.2.*",
    "clickstorm/cs_seo": "3.*",
    "Bm/ah-content-api": "0.0.1",
    "Bm/ah-contentelements": "0.0.1"
  },
  "scripts": {
    "typo3-cms-scripts": [
      "typo3cms install:fixfolderstructure",
      "typo3cms install:generatepackagestates"
    ],
    "post-autoload-dump": [
      "@typo3-cms-scripts"
    ]
  },
  "extra": {
    "typo3/cms": {
      "web-dir": "public"
    },
    "helhum/typo3-console": {
      "comment": "This option is not needed ay more for helhum/typo3-console 5.x",
      "install-extension-dummy": false
    }
  },
  "autoload": {
    "psr-4": {
      "Bm\\AhContentelements\\": "public/typo3conf/ext/ah-contentelements/Classes",
      "Bm\\AhContentapi\\": "public/typo3conf/ext/ah-contentapi/Classes"
    }
  }
}

What do I wrong, I'm struggling with this for days now..

Upvotes: 0

Views: 209

Answers (2)

G-Agnes
G-Agnes

Reputation: 101

I think the path is wrong: you have to use the root (the directory on the same level like your composer file and the vendor directory) like "web" or "html".

so instead of

"autoload": {
"psr-4": {
  "Bm\\AhContentelements\\": "typo3conf/ext/ah-contentelements/Classes",
  "Bm\\AhContentapi\\": "typo3conf/ext/ah-contentapi/Classes"
}

you should use something like

"autoload": {
"psr-4": {
  "Bm\\AhContentelements\\": "web/typo3conf/ext/ah-contentelements/Classes",
  "Bm\\AhContentapi\\": "web/typo3conf/ext/ah-contentapi/Classes"
}

After changing do not forget to composer dump-autoload

Upvotes: 1

Peter Kraume
Peter Kraume

Reputation: 3747

I never did it the way you did it. I always include a composer.json in each of my extensions. There the autoload part looks like this:

"autoload": {
  "psr-4": {
    "Bm\\AhContentelements\\": "Classes"
  }
}

In the repositories section of my main composer.json I then have something like this:

{
  "type": "path",
  "url": "./packages/*"
},

I then require my extension with composer require Bm/ah-contentelements:"@dev". Composer then searches the packages directory for the specified extension.

Upvotes: 1

Related Questions