Skip to content
Advertisement

Tag: yii2

Yii2: Rest POST Request Parameters not arriving

Good morning, I dont get any further in this Topic so i am writing a Question here. First of all i created a DB Table with Data from the Tutorial: https://www.yiiframework.com/doc/guide/2.0/en/start-databases Then i created a Rest Controller from that Tutorial with the Data above: https://www.yiiframework.com/doc/guide/2.0/en/rest-quick-start The first example GET Request from the Tutorial works fine and gives me all of

Yii2: Controller action parameters with a dash?

If I have a URL like https://example.com/controller/action?customer-id=7414 how do I get customer-id in my action parameters? Since a dash is not allowed in variables names I cannot do the following! Documentation is usually excellent but on this exact point it’s just silent. How do I solve this? Answer When yiiwebController calls action it only binds parameters which names match exactly.

TypeError Yii2 Framework

yiibaseView::{closure}(): Argument #2 ($model) must be of type Libro, appmodelsLibro given in C:xampphtdocsbibliotecaviewslibroindex.php ]); ?> Answer Change your closure from: Into: In other words, use right class as type (appmodelsLibro instead of Libro).

How to print string to console Yii2

I am really new to Yii2 and I am trying to print a simple string to the console. However, no matter what I do, I can’t really make it work. I am not sure if I have my Setup wrong or if I simply don’t use the functions as intended. My TeamController.php was generated by Gii and the function I

time using asTime() not correct

in my Grid view i have this to change the column time and date to use my timezone then in my search model i have this i also have this in my main.php components in my database the created_at is saved like this 2021-11-22 11:28:16 UTC how do i get it to show the correct time based on my timezone?

Why doesn’t the message POST

When sending data, an empty value comes in Yii2, why is that? Data post: id, name. JS PHP } Code 200, post null Answer By default the Yii reads post params from $_POST global variable. But web server only parses request of body send as application/x-www-form-urlencoded or multipart/form-data. If you send data with Content-Type: application/json they are not parsed into

Session Problem on Redis with Docker + Nginx + Yii2

The question is, i am having a problem with session using Docker with Nginx + Yii2 + Redis. I want use same login on banckend and frontend in Yii2 advanced template. I just configured all its ok, its work when i do not use Redis, but when i use Redis, dont work. My configuration is: Yii2 advanced 2.0.43 Nginx 1.17.8

How to allow CORS in Yii2?

I have a JavaScript frontend that ask for a plain text to my PHP backend. It almost works excepts because I have a CORS problem. How can allow CORS in my PHP code? My frontend (JavaScript and jQuery): My backend (PHP and Yii2): Answer Yii2 supports CORS handling, as written on the official documentation. Alternatively, you could try adding the

Fitbit Auth 2 Api integration without Token expired

Currently, I am working/integrating Fitbit API on my Yii2 framework. Code sample like this: API Integration is currently done and working fine, but after a certain time token expired, I never want customers again and again to accept a request, I want customers to accept requests once and never expired token and not need to connect again and again. Any

Advertisement