I have module stored in /common/modules/gopay/GopayModule.php and I am dynamically loading it via Yii::$app->setModule('gopayModule', ['class' => '\common\modules\gopay\GopayModule']); in CommonController which is child of yii\web\Controller and parent of all my FE and BE controllers.
I did not put any configuration for module into config files as Im loading it dynamically.
How can I access this module from frontend, so that it creates application based on FE config and so on? What decides which part of Yii2, BE or FE should be called when calling module route? Traditional routes as /index.php?r=gopayModule/default/index or /gopayModule/default/index are not working even when url manager is none.
thx :)
:D easy peasy, I was setting module late, I changed code to load/set module in my CommonRequest class init() method and everything working like a charm, so logically I need to load module before UrlManager is processing URL ;-)
Related
I have a react application created using "create react app rewired". I've installed ts-jest and want to be able to customize Jest. I read the documentation from ts-jest and executed npx ts-jest config:init at the root level of my project to create the initial configuration file. To test that jest is indeed using that configuration file, I wrote the following line console.log(window); in a sample test file and modified the configuration such that testEnvironment is set to "node".
I am expecting the test to fail due to window being undefined, but I am getting the window object back. I tried renaming the file to jest.config.ts and I got the same result.
I did a global search across all the files to see if there's another configuration file somewhere that is overriding my configurations, but there was none found.
What am I doing wrong? I know jest comes pre-packaged with create-react-app (CRA). I would imagine that create-react-app-rewired would only include some wrapper above CRA so where is it getting its configurations from?
I've come to realize that create-react-app-rewired package had nothing to do with this issue since it is simply a wrapper package that exposes a configure-overrides.js file to allow developers to modify the webpack configurations managed by create-react-app.
The jest.config.ts or jest.config.js config file I created had no effect because create react app (CRA) will generate and use its own jest config file underneath the hood.
I discovered this by happenstance while researching on another issue. A comment by dstapleton92 on GitHub helped me draw this conclusion.
Create React App supports overriding SOME of the values via the "jest" property in package.json file. Upon inspecting the jest config factory function in CRA, testEnvironment property is hard coded to "jsdom" and the key is not exposed as part of the list of overridable properties.
This is why the attempts I made were not successful.
The CakePHP docs on using the FormHelper suggest I should be able to create new templates for its output once, and use this throughout my project.
As described it requires modifying the loading of the FormHelper, from this:
$this->loadHelper('Form');
to this:
$this->loadHelper('Form', [
'templates' => 'app_form',
]);
where app_form refers to a file in the config directory. However, I haven't had to actually load the FormHelper at all, it's magically available already, and if I try to do the above I get an error to the effect the helper has already been loaded:
The "Form" alias has already been loaded with the following config: array (...
Don't know if the docs are out of sync with the current version of CakePHP, but I can't see how to use this functionality - anyone know?
New to Umbraco and having a problem updating the code of an existing site (Umbraco version 7.2.8).
Editing views works fine but when editing a model and/or controller the site does not change.
The files I'm editing are located in:
/Models/*.cs
/Controllers/*.cs
Could someone supply details on how to compile these?
Depends on where your code behind files are located. If they're in /App_Code you shouldn't have to compile, I believe, but anything other than that (like /Models/*.cs or /Controllers/*.cs) will have to be compiled.
Your controller names should end with SurfaceController.
All models you create as in Models folder.
You might need to reference your models in controller
Is it a good idea to put a none-AJAX form into a Joomla module and process the form not in a component's controller but in the module itself? Is there a cooking recipe for this?
That's completely fine.
Components shouldn't use used to process a modules data, unless the module has been specifically developed to be part of the component.
Take com_users for example. This component is used to do all processing for registration, login, logout, profile and reminder/reset of passwords. The login module then simply displays the form and performs a few checks.
i'am trying to use components from another module, but is not working.
Look what i have:
I have my project, its an app to convert files, and its working everything is ok. Now i want to change the interface... for that i cloned a github repository thats is a project with the components that i want to use, and imported it as a module. (should i import as a module or as a project?)
Everything great till now, but when i try to use the components from the module i cant find the classes or even the module...
Any suggestions?
You should add your imported sources as a new module (let's call it B), then you should add a dependency from your original module A to your module B in order to use its code.
See this page on how to configure module dependencies.