Questions tagged [yii2-module]
28 questions
6
votes
1 answer
How to create submodules in yii2
I am using yii2 framework. I have two pages business and contact. I have used CRUD to generate the pages. Now I have to get one sub module to access contact when I use business page. I have to get access from business page to contact using URL. Once…

user4809486
- 65
- 1
- 5
4
votes
1 answer
Yii2 load modules
How I can load an external-site module? I have a common module I need to load in distinct Yii2 sites, like advanced-template my idea is to have a common dir where store generic modules which I can load to each site. A file system structure can be…

MarBer
- 535
- 1
- 5
- 22
2
votes
1 answer
Yii2 Testing: How to run module tests along with main app test?
I want to run my main application Codeception tests and have it automatically go through the tests provided by 3rd party modules (assuming they come with their own Codeception configurations) installed through composer (which means they are living…

mae
- 14,947
- 8
- 32
- 47
2
votes
1 answer
How to make yii2 module load at root level
I'm more of a frontend guy (CSS, javascript) trying to expand my knowledge about backend (apache, proxies) (so try to be gentle) and I'm asking after serveral hours of documentation, trying different approaches but so far nothing worked. I'm aware…

tao
- 82,996
- 16
- 114
- 150
1
vote
1 answer
How to include image in Yii2 module
Cannot provide correct path to image in view inside of Yii2 module. Script and styles are loaded correctly.
module structure:
|-assets
| ↳Asset.php
|-controllers
|-models
|-public
| |-css
| | ↳styles.css
| |-js
| | ↳script.js
| |-img
| …

Volpacchiotto
- 75
- 1
- 1
- 8
1
vote
1 answer
get nested json object containing all the related data in yii2
I am writing an api to fetch data. I have three models Page , Section and Question.This is image of the erd diagram showing relationship between different entities .
I have defined there relationships in respective models.
Page Model
class…

umair.ashfr
- 1,171
- 13
- 32
1
vote
1 answer
Yii2: How to create module commands without controller name?
There was a similar question asking "how to create console command in a module?" which contains a good answer on how to add commands to your Yii2 modules.
However, the resulting commands must be in the following format:
./yii…

mae
- 14,947
- 8
- 32
- 47
1
vote
2 answers
Yii2 access to module instance from model
I want to know if there is a way to access at the module instance from a model. In my module configuration I have some components which I need to call in a model class, the model is defined only inside my module. I know the method…

MarBer
- 535
- 1
- 5
- 22
1
vote
1 answer
How i can force an yii2 module to use a specific connection for all his models?
on a module I have add a component named db where i put, like the main Yii component, the data for database connection, I need in my module use everytime the db specified in his configuration for all models and not the main database connection, how…

MarBer
- 535
- 1
- 5
- 22
1
vote
2 answers
Yii2: How to modify tables created by module migrations?
Say we add a 3rd party module that comes with a bunch of migrations, and one of the migrations creates a post table. What if we want to modify this table? We may want to add another column, or add a foreign key and link it to one of our project's…

mae
- 14,947
- 8
- 32
- 47
1
vote
1 answer
How to change source translation in yii2 in lajax/translatemanager module
I installed this translate manager on my Yii 2 Advanced application and I'm trying to translate source variant.
Imagine that I have 2 languages - English and German. In my code I have Yii::t('frontend', 'Hello'). And I translated it to German like…

Link
- 669
- 7
- 20
1
vote
1 answer
Yii2: Render module view from main application
How can a Yii2 application Controller (not a module controller) render a view that is provided by a module, assuming the module follows the directory structure outlined in the documentation?

mae
- 14,947
- 8
- 32
- 47
1
vote
3 answers
Yii2: Omit controller ID from module route
A typical Yii2 route to any action in a module controller is as follows:
//
How do we configure/structure our module (which has only 1 controller) so that we may reach its actions directly using the following…

mae
- 14,947
- 8
- 32
- 47
1
vote
1 answer
Yii2 strange errorException on call Yii::$app->
I'm implementing an yii2 module for handle slider inside my application, the base structur of project is yii2 advance template.
I've a class Images wich extends another model class generated by gii,
Images.php

MarBer
- 535
- 1
- 5
- 22
0
votes
0 answers
Yii2 translate a module from outside
If you have a yii2 module installed by composer how can you add a new language without touching the module itself (since touching anything in vendor/ is quite a bad practice)?
Let's say you have a module vbt-cron which already have an English an a…

Zhigalin - Reinstate CMs
- 746
- 1
- 9
- 33