Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [yii]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Pass params to transform function of Transformer class in split Transformer class

I have transformer like down below in the element API. 'transformer' => 'MyTransformerClassName', Or 'transformer' => new MyTransformerClassName(), I am going to pass a param like $user ...
2
votes
0answers
36 views

How to wire html template to twig extension? (Mainly `Twig\Error\SyntaxError: Unknown filter Error`)

I am going to use a Twig filter function by using Twig extension in my HTML file. I followed this guide. https://cameronspear.com/craft-cms-twig-filter-extension/ But when I run <p>{{ 123 | ...
1
vote
1answer
67 views

Fetch Entries with Tags Only

I'm trying to get all the entries which have tags associated with them. At the moment I'm doing: $entries = Entry::find()->with('tags')->all(); and then filtering the results in PHP as ...
1
vote
1answer
22 views

Select specific fields from query

I'm trying to get tags out of the underlying craft DB and serve it as a REST endpoint - however, I'm only interested in exposing the tag id and title, so my data should look like this: {id: 1, title:...
1
vote
1answer
44 views

Custom module controller getView()->renderTemplate() path not working

Module loads and controller actions work. Craft 3.3.7. I'm trying to find out what is the path to use to render the view. From the Doc: return $this->renderTemplate('plugin-handle/path/to/...
1
vote
1answer
22 views

Can access admin page (now), but not any site pages…yii not found http execption

Have not accessed my local .test sites in a bit. I tried today. I am getting a series of errors. At first I could not access any page to include the admin page. I ran Composer update from the ...
3
votes
2answers
226 views

How to access HTML input values from Twig and vice versa

I am new to Craft and Twig in general. I have encountered the following problems and struggling to find a solution for hours. I want to access the value of "foo" input field inside the twig ...
0
votes
1answer
32 views

Fatal PHP error upon installation

I attempted to install the newest version of Craft and received this error in my logs: PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\craft-cms\vendor\yiisoft\yii2\...
1
vote
1answer
146 views

PHP Fatal error during installation

I am trying to run craft inside a homestead box. The box boots and installs everything correctly, and when I navigate to http://localhost:8000/admin I see the install screen and can click through the ...
1
vote
2answers
151 views

CraftCMS config on WTServer / WinNMP for Windows with Nginx

Has anyone had success with using Craft and WTServer (WinNMP) together? I'm getting a 400 error at "http://craft.test/index.php?p=admintrigger/actions/users/login" after trying to login the admin. I'm ...
3
votes
1answer
56 views

Craft CMS V3 Create New User

Having difficulties creating a new user in a custom controller, here's my implementation: use craft\records\User; $user = new User; $user->firstName = $userData['firstName']; $user->lastName = ...
1
vote
1answer
274 views

upgrade issue Yii Framework from version 2.0.15.1 to 2.0.16.1

I tried installing a site I developed on my work mac (high sierra), pushed to its repo, pulled it down at home on my mac (mojave)and on running composer update get this displayed in my terminal: ...
1
vote
0answers
43 views

Order entries by a matrix field category

I have a lot of trouble in understanding the database/model structure and how to work with the query builder. I tried playing a bit with leftJoins but i cannot seem to make complex queries in craft 3. ...
2
votes
2answers
63 views

How do I prevent a controller from creating unwanted routes?

I have a custom module that is adding sections to the CP, like this: // Register CP routes Event::on( UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function(craft\events\...
1
vote
1answer
305 views

Integrating Yii 2 modules and frontend widgets with Craft CMS 3

I'm experienced in Yii2 framework, but I just discovered Craft CMS and I already love it. I use to develop Yii 2 modules using their own DB tables, models, controllers and views. I usually use Yii ...
1
vote
1answer
595 views

How do I create console commands for my module or plugin?

I would like to create a custom console command for my Craft 3 plugin. I've looked at the Yii docs and understand commands are defined using controllers extending \yii\console\Controller but cannot ...
1
vote
1answer
59 views

Connect to an external database from a Craft 2.x plugin

I recently saw a very helpful post about how to connect to an external database from a Craft plugin and I wanted to confirm I understood the implementation correctly. On this response the author ...
1
vote
1answer
129 views

Craft Rules and Validation

Some of the changes in craft 3 have been killing me. I know Yii does validation using the public rules function. Here is a rules function I grabbed from the MatrixBlockType model. function rules() { ...
1
vote
1answer
85 views

where command sql query not working

My problem is that I can't update the specific $userId. have the values I've selected. I also get an error: Call to a member function where() on integer I just started to learn Craft. It can be ...
2
votes
1answer
579 views

Craft 3 Element API Authentication/Login

First things first: This is quite similar to this, yet different. I'm trying to get authentication/login for Element-API for Craft 3 to work. Meaning I would like to restrict access to certain ...
1
vote
3answers
264 views

400 error logging into local Craft 3 project

I have just tried to log into an old local Craft 3 project that hasn't been worked on in a few months and I'm getting the following: HTTP 400 – Bad Request – yii\web\BadRequestHttpException Unable ...
4
votes
0answers
294 views

Craft 3 Custom Plugin: model validation

Struggling a bit here - have created a custom plugin where I want to validate form submission against a predefined model before saving to the database. All pretty straightforward so far … However, if ...
2
votes
1answer
325 views

Yii Modules in Craft, samples?

Does anybody know of a collection or library of Yii Modules online? I'm trying to understand how easy they can be moved from one application to another, are we going to see something similar to the ...
1
vote
1answer
106 views

Craft 3 icons not found in craftcms/cms/src/icons

Craft 3 version 3.0.4 When logging into the admin panel on Craft3 for some reason I'm getting a Yii2 PHP Warning for missing icons. Error message: PHP Warning – yii\base\ErrorException ...
1
vote
0answers
350 views

What are my caching options when using CraftQL and React?

I’m experimenting with the CraftQL plugin and React with Craft 3, and I’m really liking the similar syntax to standard Twig element queries, and the fact I don't need to manually configure API ...
7
votes
3answers
3k views

Craft 3: how to show the Yii Debug Toolbar?

I'm using Craft 3 RC and I am logged as an admin. How can I display the Yii debug toolbar on front-end and Control Panel requests? By default, I don't see this toolbar.
5
votes
2answers
1k views

Craft 3 404 and 503 pages in devMode

Is there any way to get Craft 3 to display 404.html and 503.html for the 404 and 503 pages while in devMode, as it did in Craft 2, rather than returning the entire Yii 2 error stack? Sometimes, we ...
1
vote
2answers
158 views

Craft login problem with memcache and ubuntu?

session_regenerate_id(): Session object destruction failed is the error i'm receiving after attempting to log in. I just updated to Ubuntu 16.04LTS using PHP7 and php-memcached. Is there a fix for ...
3
votes
2answers
2k views

Craft 3 Plugin Routing Problems

So I am working on converting a previously-standalone Yii 2 app into a Craft module and am having some issues with routing. I wish to keep my old URL structure as much as possible. As such, I ...
1
vote
1answer
131 views

Getting back after forwarding to another controller function

I want to assign a new user to a user group using a variable passed in the frontend registration form. I was going to listen for the OnSaveUser event but I don't think there's a way to get the ...
1
vote
1answer
554 views

Joining two plugin tables by reference Id causes duplicates

I'm running a query in which I need to join two tables table_views and table_clicks. Both tables share several column names (mainly refId, month, year and total). However when I try and join these ...
2
votes
1answer
56 views

Craft equivalent to Rails runner

The Rails cli has a runner feature that allows you to run a file (or a string of code) from the command line. E.g. rails runner my-script.rb (where my-script.rb will run in the context of a fully ...
1
vote
1answer
263 views

Setting query offset

I need to batch process a set of data. To do this I am using the code below. I am trying to process 100 at a time, but the offset doesn't seem to work. It works the first time, but in the second ...
1
vote
1answer
589 views

CraftCMS 3 - Composer Update

How can I update all the packages under craft/app/vendor for Craft CMS 3 (Yii 2)?
2
votes
1answer
96 views

Changing cache type

Is it possible to use different types of cache in Craft? Yii made a point how different caches are better for different reasons: Tip: You may use different cache storage in the same application. A ...
1
vote
0answers
200 views

Craft Cache Dependency with Redis

I am trying to make dependency's work using Craft Cache (set to Redis.) I've tried: craft()->cache->set('cache_key', 'cache_value', 0, new CFileCacheDependency('dependent_cache_key')); This ...
1
vote
0answers
121 views

Detaching onSaveEntry events from craft()->entries->saveEntry($entry)?

I have a plugin that does a bunch of stuff with external APIs onSaveEntry and then saves some of the gathered information back into the entry. I currently use craft()->entries->saveEntry($entry);...
2
votes
1answer
581 views

How to add to arrays in models?

I have a model that contains a bunch of storage arrays where I collect results from various services I have written. class Shipper_ResultsModel extends BaseModel { shipping categories for debugging ...
2
votes
1answer
767 views

Multi-page form with Yii in a Craft site?

I have a Craft-based website and need to make a complex multi-'page' form on one page. The form isn't related to any Craft Entries etc, and doesn't need to save the submitted data to Craft's database (...