TYPO3 10.4 new fields not found in frontend - typo3-10.x

I have extended database table fe_users with new field using extension builder. The fields are visible in backend user-interface, but not available in frontend in Typo3 10.4.x . But the same code works fine in Typo3 9.x frontend and backend.
I have also tried setting recordType to nothing in the ext_typoscript_setup.typoscript but this also does not help
mapping {
tableName = fe_users
recordType =
}
Any ideas on what more to look for?

The table mapping of the Extbase persistence is not longer possible in TypoScript. Migrate your TypoScript to a PHP file named EXT:myextension/Configuration/Extbase/Persistence/Classes.php.
See breaking change 87623 for further details.
A typical Classes.php file looks like the following.
<?php
return [
\Vendor\Extension\Domain\Model\Object::class => [
'tableName' => 'tx_extension_domain_model_object',
]
];

This is how I implemented it. There was one more line (.i.e 'subclasses') that had to be added to Michael's response. (This is tested in Typo3 11.x as well)
My Configuration/Extbase/Persistence/Classes.php
<?php
declare(strict_types=1);
return [
\TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class => [
'subclasses' => [
'\T3IN\T3inStores\Domain\Model\UserStore' => \T3IN\T3inStores\Domain\Model\UserStore::class,
]
],
\T3IN\T3inStores\Domain\Model\UserStore::class => [
'tableName' => 'fe_users',
'recordType' => 'Tx_T3inStores_UserStore',
],
];
Ref
For every superclass additional all subclasses have to be declared under subclasses
recordType : Look up the TCA of the model to get this value. Or lookup DB after creating a record of that type.

Related

Typo3 External importer is not mapping extended news fields

Using cobwebch/external_import and after extendig tx_news_domain_model_news with custom fields I try to map on import those. But the new created fields are not getting recognized by mapper.
my config which relays in TCA/Overrides/tx_news_domain_model_news.php and looks as it follows
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['link_external']['external'] = [ 'news' => [ 'field' => 'tx_newsrundbrief_ext_link' ], ];
I'm using version 5.1
What I'm missing in this case?

Two Yii2 applications Login conflict

I have two different Yii2 Basic template applications on the same hosting. When I login to the first Yii2 app and then go to login the secon Yii2 app, the first automatically logs out and vice versa. They use different cookieValidationKey in config. How to fix this.
I'm not sure if it fixes your problem but try to change configuration for identityCookie in one of the applications.
'components' => [
// ...
'user' => [
// ...
'identityCookie' => [
'name' => '_identity', // <-- change _identity to something else
'httpOnly' => true
]
]
]

Extending Laravel 5.1 Mess Detection the right way

Laravel 5.1 has only one built-in hardcoded Mess Detection, it searches to see if #package tag is the same with /namespace, like so:
preg_match('/namespace\ ' . self::REQUIRED_NAMESPACE . '\\\(.*);/isU', $content, $namespace);
preg_match('/\/*( )+#package\ (.*)[\r?\n]/isU', $content, $package);
if (!isset($namespace[1]) || empty($namespace[1])) {
continue;
}
I want to extend this to add multiple detection classes.
My folder structure currently looks like this:
Helpers >
Commands >
MessDetector >
Detector >
DetectorInterface.php
DetectorAbstract.php
PackageTagDetector.php
MessDetector.php
The file MessDetector is made as an Artisan Command, that means it extends \Illuminate\Console\Command
I have a config file called mess_detection.php which has the detection rules like so:
return [
'rules' => [
'\Helpers\Commands\MessDetector\PackageTagDetector' =>
[
'rule' => '/\/*( )+#package\ (.*)[\r?\n]/isU',
'path' => app_path(),
'info' => 'Checking for #package tag',
'error'=> 'Malformed or missing package tag'
]
]
];
But got stuck with figuring out how exactly to instantiate PackageTagDetector class in MessDetector class.
Any ideas design pattern wise?
Laravel has no built in mess detector.
Also checking if package tags matches the namespace is a custom convention, Laravel doesn't use package tags at all.
It seems like you are using a third party library?
I have made an abstract class and interfaces for every rule I needed.
Each rule had it's own class.
The rules extended the abstract and in the abstract most of the logic was used.
The rules themselves where stored in a config file, in the config file I also mentioned the class and class specific actions.

restfullapi event calling in Yii

I am working on Rest Api on YII. I integrated RESTFULL extention. In this some one used this below code. What is SINGLE in below onRest Event. Can anybody explain plz.
$this->onRest('req.get.single.render', function ($id, $user_id) {
$data="hi";
$this->emitRest('req.render.json', [
[
'type' => 'raw',
'data' => $data
]
]);
It's might be called when a GET request for a single resource is to be rendered. But, I never saw SINGLE in *Yii RESTFULL extension's event. You can reference in this or this

What is the correct place to set the Default Namespace for a Multiple Module project created with Phalcon DevTools?

I just started looking about Phalcon this week, I'm trying to create a multiple module application with the dev tools.
The result of running phalcon project <name> multiple only creates one module ('frontend') and it works fine. However, when I add a second module (by copying the frontend one and changing the namespace to \Backend , I couldn't get to the Backend\IndexController class.
After reading the doc page about mutiple module applications and looking at the samples (https://github.com/phalcon/mvc/tree/master/multiple and https://github.com/phalcon/mvc/tree/master/multiple-volt) and an old question on the Google group (sorry, can't post more than 2 links since I'm new on StackOverflow), I've ended commenting this this line on the services.php file:
$router->setDefaultNamespace("MyL\Frontend\Controllers"); //project name is MyL
and adding the following on the setServices of my backend/Module.php file:
$di->set('dispatcher', function() {
$dispatcher = new Dispatcher();
$dispatcher->setDefaultNamespace("MyL\Backend\Controllers");
return $dispatcher;
});
and the something similar on the frontend/Module.php
It works with these modifications, but my question is: is this the best way to do it, or is there a better way?
Thanks in advance!
You need to register your modules in your app like so:
$app = new \Phalcon\Mvc\Application();
$app->registerModules(
[
'frontend' => [
'className' => 'MyL\Frontend\Controllers',
'path' => '../apps/frontend/Module.php'
],
'backend' => [
'className' => 'MyL\Backend\Controllers',
'path' => '../apps/backend/Module.php'
],
]
);
Make sure that you have the Module.php ready also for each module
Here is a simple way to split frontend and backend in Phalcon project without modules:
https://github.com/borzov/phalcon-templates