InvalidArgumentException in TYPO3 extension we_cookie_consent - typo3

I am getting an error in we_cookie_consent TYPO3 extension. This error occurs after I installed bw_focuspoint_images extension. I have installed both extensions via composer. My TYPO3 version is 10.4.21.
(1/1) #1411840171 InvalidArgumentException
The class "Websedit\WeCookieConsent\Resource\Rendering\YouTubeRenderer"
you are trying to register is not available
in /www/htdocs/w01c6c77/t3carthago.digitalfairydust.dev/t3carthago2021/public/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php line 60
at TYPO3ICMSICorelResourcelRendering RendererRegistry-›registerRendererClass(WebseditlIWeCookieConsentlIResourcellRendering|YouTubeRenderer')
in /wwwhtdocs/w01c6c77/t3carthago.digitalfairydust.dev/t3carthago2021/public/typo3conflext/we_cookie_consent/ext_localconf.php line 7
composer.json code:
"autoload": {
"psr-4": {
"Carthago\\CarthagoExt\\": "public/typo3conf/ext/carthago_ext/Classes/"
}
}
The issue is with these two lines in ext_localconf.php of the we_cookie_consent extension
$rendererRegistry->registerRendererClass(\Websedit\WeCookieConsent\Resource\Rendering\YouTubeRenderer::class);
$rendererRegistry->registerRendererClass(\Websedit\WeCookieConsent\Resource\Rendering\VimeoRenderer::class);

Related

Class not found error on custom TYPO3 extension

I have a custom frontend extension that I have installed on TYPO3 10.
I took a snippet of code from another friend extension and I have some problem to declare the hook class:
under hooks I have a file PageLayoutView.php.
class PageLayoutView implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface {...
Then in the ext_localconf.php I have added this line:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][$_EXTKEY] = \MyVendor\myTheme\Hooks\PageLayoutView::class;
in ext_tables.php file i have the following namespace:
call_user_func(
function()
{
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Myvendor.myExtname',
'Templates',
'Ext name'
);
In the backend I get this error:
(1/1) Error
Class 'MyVendor\myTheme\Hooks\PageLayoutView' not found
what i'm missing here ?
Did you try to dump the autoload information in the TYPO3 Install Tool?
If it's a composer based installation, try to remove the extension completely and require it again afterwards.
And you should check the namespace in PageLayoutView.php.

TYPO3 9.x News 7.x: adding extra custom type error

The current Behavior:
I wanted to add an extra custom type and followed:
https://docs.typo3.org/p/georgringer/news/master/en-us/DeveloperManual/ExtendNews/AddCustomType/Index.html
Exactly at it was explained there...
The expected behavior/output:
This gives me in the Backend an extra custom type myCustomNewsType.
However, when I call the Frontend, I get:
Core: Exception handler (WEB): Uncaught TYPO3 Exception:
#1476045117: Could not find class definition for name "Galileocr\CustomPackage\Domain\Model\MyCustomNewsType".
This could be caused by a mis-spelling of the class name in the class definition. | TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidClassException thrown in file /usr/home/galileo98/public_html/typo3_src-9.5.11/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php in line 131.
Environment
TYPO3 version(s): [9.5.0]
news version: [e.g. 7.0.5]
Composer (Composer Mode): [ no]
OS: [e.g. OSX 10.13.4]
I have no idea why this occurs, is this example not complete?
Did you configure the class autoloading after adding the new class? If this is a try-out, you should add an autoloading line to the composer.json in the root of your project.
{
"autoload": {
"psr-4": {
"Galileocr\\CustomPackage\\": "typo3conf/ext/custom_package/Classes/"
}
}
}
After that you should regenerate the autoload files by issuing a composer dumpautoload from the directory in which you just edited the composer.json.
I did not make the TYPO3 install with composer (no composer file in the root of my project), did it the "classical" way.
However, you definitely pointed me in the right direction: I opened the file typo3conf/autoload/autoload_psr4.php:
<?php
// autoload_classmap.php #generated by TYPO3
$typo3InstallDir = \TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/';
return array(
'BK2K\\BootstrapPackage\\' => array($typo3InstallDir . 'typo3conf/ext/bootstrap_package/Classes'),
'GeorgRinger\\News\\' => array($typo3InstallDir . 'typo3conf/ext/news/Classes'),
);
So no reference to my custom class...
Therefore, I went to Admin tools->Maintenance->Rebuild PHP Autoload Information and refreshed the autoload info. After that, the same file looks like this:
<?php
// autoload_classmap.php #generated by TYPO3
$typo3InstallDir = \TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/';
return array(
'BK2K\\BootstrapPackage\\' => array($typo3InstallDir . 'typo3conf/ext/bootstrap_package/Classes'),
'Galileocr\\BciePackage\\' => array($typo3InstallDir . 'typo3conf/ext/bcie_package/Classes'),
'GeorgRinger\\News\\' => array($typo3InstallDir . 'typo3conf/ext/news/Classes'),
);
The the problem was fixed!!!
Thanks and regards!
Bert

TYPO3 : Extension upgrade from version 7 to 9

I just updated my TYPO3 site from 7.6.x to 9.5.x and I get error with a custom extension :
Error :
Call to a member function exec_SELECTquery() on null
I think my plugin is not compatible with TYPO3 9.5.x.
The error come from this line :
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy, $orderBy, $limit);
How to edit this line to make it works with TYPO3 9.
With TYPO3 9 the database interface $GLOBALS['TYPO3_DB'] has beeen removed and the usage of doctrine-dbal is mandantory.
you can get more information along with some examples in the chapter about migration in the manual.

TYPO3 tutorial extension, controller does not exist

I'm trying to get started with TYPO3 extensions and was following this tutorial to get to see the basics.
In the backend everything works fine, but on the front end I get an error:
Oops, an error occurred! Code: 20170209104827c3b58d58 -
{"exception":"exception 'ReflectionException' with message 'Class
Tx_Inventory_Controller_InventoryController does not exist'
My files are exactly the same as in the tutorial. I have no idea what is causing this. I assume I made some dumb mistake with namespaces, but they seem to be all correct.
The controller class can be found below and is located in typo3conf/ext/inventory/Classes/Controller/
<?php
namespace \MyVendor\Inventory\Controller;
use \TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use \TYPO3\CMS\Core\Utility\GeneralUtility;
use \MyVendor\Inventory\Domain\Model\Repository\ProductRepository;
class InventoryController extends ActionController {
public function listAction() {
$productRepository = GeneralUtility::makeInstance(ProductRepository::class)
$products = $productRepository->findAll();
$this->view->assign('products', $products);
}
}
?>
When developing a new extension in a composer installed TYPO3 V9 (here: 9.4) the autoload part has to be added to the central root composer.json. Found it here (German). Following the steps in the OPs mentioned tutorial leads to a core exception:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1278450972:
Class MyVendor\StoreInventory\Controller\StoreInventoryController does not exist.
Reflection failed.
As long as the extension is not installed via composer, e.g because it's newly developed, composer does not find the appropriate composer.json file in the extensions directory. Hence TYPO3 does not find any classes in the new extensions Classes directory. To resolve the issue the autoload configuration has to be added to the root composer.json. Just put the following lines into composer.json within the installations base directory:
{
"repositories": [
{ "type": "composer", "url": "https://composer.typo3.org/" }
],
...
"autoload": {
"psr-4": {
"MyVendor\\StoreInventory\\": "public/typo3conf/ext/store_inventory/Classes/"
}
}
}
Then regenerate the autoload configuration:
composer dumpautoload
You possibly have to clear the cache as well in the backend.
It looks like your class is not autoloaded. If you don't use composer to make your autoload, take a look in your typo3conf/autoload/autoload_classmap.php file.
You should find an entry corresponding to your file. You will see if you have a path error.
Remove backslashes - try with
<?php
namespace MyVendor\Inventory\Controller;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use MyVendor\Inventory\Domain\Model\Repository\ProductRepository;
class InventoryController extends ActionController {
public function listAction() {
$productRepository = GeneralUtility::makeInstance(ProductRepository::class)
$products = $productRepository->findAll();
$this->view->assign('products', $products);
}
}
Ensure you add Vendorname to extension key, when you register your plugin, see ext_tables.php and write 'MyVendor.'.$_EXTKEY instead of $_EXTKEY like
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'MyVendor.'.$_EXTKEY,
'List',
'The Inventory List'
);
I had exactly the same problem - it happens if Typo3 installation is done by composer. To solve this problem see this page of the docs.
Try to add autoload in your ext_emconf.php (replace 'Vendor\\Extensionkey\\') and uninstall and install your extension again (to rebuild PHP autoload information)
'autoload' =>
array (
'psr-4' =>
array (
'Vendor\\Extensionkey\\' => 'Classes',
),
),
'_md5_values_when_last_written' => 'a:0:{}',
'suggests' => array(
),

Include Zend In Symfony 2

I have a problem for including Zend Framework in Symfony 2 IN PRODUCTION, because when i use it on local there is no problem ...
I just commited my work on my production server and i have this error :
Fatal error: Class 'Zend_Gdata_AuthSub' not found
And there is this error for any classes of Zend Framework ...
This is my autoload which is good for localhost :
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = require __DIR__.'/../vendor/autoload.php';
// intl
if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
$loader->add('Zend_', __DIR__.'/../vendor/zf/library');
}
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
set_include_path(__DIR__.'/../vendor/zf/library'.PATH_SEPARATOR.get_include_path());
return $loader;
?>
There is probably a problem with the include path but i don't know why ...
Thanks a lot !
If you want to use Composer to pull in the components you need from ZF2 then you could use the information at Zend Framework site Composer info page
As an example you can add code like this to your composer.json file to enable the repository:
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
}
],
"require": {
"zendframework/zend-config": "2.0.*",
"zendframework/zend-http": "2.0.*"
},
You place the names of the packages you want to pull in under the "require" section and the list of available packages is at the link I supplied so you can check the names there.
When you go to install the dependencies you can use this command:
php composer.phar install
Does that help? :-)