TYPO3 9.5 Extension Builder throws Exception - typo3

I try to create a new TYPO3 extension with the Extension Builder and get the following error:
Extension could not be saved: Could not generate action controller, error: PHP Warning: First parameter must either be an object or the name of an existing class in /var/www/html/public/typo3conf/ext/extension_builder/Classes/Parser/Utility/NodeConverter.php line 240
TYPO3 9.5.23
extension_builder 9.10.3
I tried two different installations (one is a plain installation with introduction_package).
Just very simple extension with
1 FE-Plugin
As soon as I add a model with a default action or a second table with a relation I get this error.

Related

How to debug `Validation failed while trying to call showAction` in another extension in TYPO3

I am getting Validation failed while trying to call showAction in another extension, but due to an extension I developed. Now I dont know where / how to debug the issue. Something tells me it should be in the setup.txt
Is it possible that my extension is somehow conflicting with this other extension? Because if my extension is deactivated then this error disappears. So then how do I debug where the problem could be in my extension?
This error is occuring when a model which is handed over as parameter is not valid.
E.g. public function showAction(\Vendor\ExtName\Domain\Model\MyClass $myClass), Extbase tries to validate the model $myClass.
You can either look why the model is not valid (preferred way) or you can say Extbase to not validate the class by adding #ignorevalidation $myClass to the function header:
/**
* #param \Vendor\ExtName\Domain\Model\MyClass $myClass
* #ignorevalidation $myClass
*/
public function showAction(\Vendor\ExtName\Domain\Model\MyClass $myClass)
{
...
}
When you want to look for the possible invalid entry you need to check the code of the model. More you can find here: https://docs.typo3.org/typo3cms/ExtbaseFluidBook/9-CrosscuttingConcerns/2-validating-domain-objects.html

sails.js : using dust in sails 0.10.5

I am trying to migrate a project from 0.9.9 to 0.10.5
We were using dust templating engine in our porject instead of the default ejs engine.
Contents of config/views.js file
module.exports.views = {
engine: 'dust',
layout: 'layout'
};
In my controller, I was able to render this view like this
res.view('layout', obj);
However, in sails 0.10.5, when I lift sails, first of all I get this warning
warn: Sails' built-in layout support only works with the `ejs` view engine.
warn: You're using `dust`.
warn: Ignoring `sails.config.views.layout`...
And then when I try to render the view as I was doing earlier, I get following error:
error: Sending 500 ("Server Error") response:
Error: ENOENT, open '/.dust'
{ [Error: ENOENT, open '/.dust'] errno: 34, code: 'ENOENT', path: '/.dust' }
Any idea what is the correct way of doing this in 0.10.5 ?
The layout property does not apply to dust (just ejs). Set layout to false to get the warning to go away. You want to use Dust's built-in support for partials and blocks anyways.
Using res.view('layout', obj); means that you expect a file called views/layout.dust to exist. Prior to 0.10, sails was including the layout property from config/views.js as part of the path.
So my best guess is that your res.view() call is actually being invoked with an empty string as the first parameter, and it wasn't breaking because you were trying to render something called layout. I'd check your invocation to make sure that you're calling res.view() with an instantiated variable.

what could I be missing in my typo3 extension to cause a table does not exist error?

I am getting this error after adding to an extension a class from another extension:
Uncaught TYPO3 Exception
#1247602160: Table 'deva.tx_bingoprizes_domain_model_hall' doesn't exist: SELECT tx_bingoprizes_domain_model_hall.* FROM tx_bingoprizes_domain_model_hall WHERE tx_bingoprizes_domain_model_hall.uid IN ('0') LIMIT 1
Tx_Extbase_Persistence_Storage_Exception_SqlError thrown in file
/home/typo3_src/typo3_src-4.5.32/typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php in line 1008.
The class added is tx_bingoprizes_domain_model_hall which should be reading from the table tx_bpscore_domain_model_hall as I added to the setup file:
config.tx_extbase.persistence.classes {
Tx_Bingoprizes_Domain_Model_Hall {
mapping {
tableName = tx_bpscore_domain_model_hall
}
}
}
as I did for other extension which also reuses this class and which works properly ( I use it as my model for how to do this and as near as I can tell did everything the same way ). Why is typo3 still trying to use table tx_bingoprizes_domain_model_hall? where else do I need to specify the other table? I tried restarting the server, clearing caches, reinstalling the extension but still get the error.
I am using the latest 4.5 typo3.
Thanks
to reiterate my comment as the answer...
OK, I got it. Once again I had forgotten to INCLUDE the necessary item (in this case bingoprizes) to the page's template. So the error was not in my extension but in the typo3 config for the page. I hate that, forget it all the time, it is counter-intuitive to me as I find it natural to assume the setup.txt stuff is auto included on any page that uses my extension.

MVC 4 project using a class library EF model

Using an EF model in the Models folder in my MVC 4 project, I succeeded to display data in a razor view using a coded class named Prod and a controller method as next:
public ActionResult Index()
{
IEnumerable<Prod> Pr = from p in db.Products
select new Prod
{
ProductId = p.ProductID,
ProductName = p.ProductName
};
return View(Pr);
}
Now I am trying to do the same thing using a model in a class library instead of the current one, so I added to my solution a new class library, added then a model using the same connection string, and mapping the same entities, then added to my MVC project a reference to the new class library, and put at the top of both MyController and Prod class the next:
using MyClassLibrary;
Then I deleted the old model, now when I try to display the view, I get the following error:
Unable to load the specified metadata resource.
Any help please ?
When you move or rename the project the data context (.edmx) is in the metadata part of the Entity Framework connection string has to change
you can try have
connectionString="metadata=res://*/MyModel.csdl|res://*/MyModel.s‌​sdl|res://*/MyModel.msl;
instead of
connectionString="metadata=res://*/Models.MyModel.csdl|res://*/Models.MyModel.s‌​sdl|res://*/Models.MyModel.msl;
or try deleting your context and recreating it then check the connection string it adds automatically.
You need to put your connectionstring in web.config in Mc4 web project
You need to Mention the datasource in the connection string.
If you have not used any other web.config file for views. Use you generic web.config file and upload a connection string with New datasource name , user and password.

symfony how to translate form error message

Does anyone know how to translate form error messages in Symfony ?
At the moment I write this line in the configure() of the form:
sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N'));
And then I overwrite all error messages with the __() method.
Is there any way for Symfony to translate error messages without calling a helper and overwriting error messages ?
How I do it:
Add to the configure function of the Form to following line:
$this->widgetSchema->getFormFormatter()->setTranslationCatalogue('forms');
Then create a translation file like:
\i18n\forms.nl.xml
(in your application root or the plugin root)
It's also possible to add translations for the default validators (like 'Required.', etc.)