Questions tagged [yii2]

Yii 2 is the latest version of the Yii framework - a high-performance, component-based PHP framework

Yii Framework

Yii is a generic Web programming framework, meaning that it can be used for developing all kinds of Web applications using PHP. Because of its component-based architecture and sophisticated caching support, it is especially suitable for developing large-scale applications such as portals, forums, content management systems (CMS), e-commerce projects, RESTful Web services, and so on.

Yii 2.0 is the current version of the Yii PHP framework, released on October 12, 2014. The latest version can be downloaded from the Yii website. Guidelines on how to upgrade minor Yii 2.0 version and changelog can be found here.

Yii 2.0 is a complete rewrite of Yii 1.1 based on PHP 5.4 improvements and aims for simplicity, performance and extensibility. The framework adopts namespaces and traits, PSR standards, , and . Yii 2.0 implements the dependency injection container and service locator. It makes the applications built with Yii more customizable and testable.

Official documentation can be found in the Definitive Guide to Yii 2.0. Further important documentation sources:

More information on the current project status can be found in the Yii 2.0 release announcement and the project roadmap.

15456 questions
3
votes
1 answer

Yii2 Boostrap period picker

I'm using Yii2 and I would like to have the following things: A dropdown with "ranges" as items (week, full week, week-end, etc.) (done) A RangePicker that based on the chosen range will: allow only some days as the startDate (ex: week = mondays;…
MHogge
  • 5,408
  • 15
  • 61
  • 104
3
votes
2 answers

Show formatted properties in Laravel's blade template

Let's say, I have some Model with updated_at attribute. I want to show it in template like this {{ $model->updated_at }} This can be used in many places so I DO NOT do this {{ $model->updated_at->format('d/m/Y H:i:s') }} But instead public…
Vitaliy
  • 429
  • 1
  • 4
  • 14
3
votes
0 answers

Yii2 migration "Foreign key constraint is incorrectly formed"

This is how I have added the foreign key inside of the migration: $this->addForeignKey( 'fk-auth_item_ibfk_1', 'auth_item', 'rule_name', 'auth_rule', 'name', 'SET NULL', 'CASCADE' …
Kyle
  • 667
  • 6
  • 28
3
votes
1 answer

Filtering yii2 produces an error Call to a member function isAttributeRequired () on null

I'm trying to filter on yii2. There is a form field in it 3 input (type = "radio"), each entry should search for products with a price in this range. Here is the controller code where the search is performed : public function actionFilter() …
sergey - dev
  • 131
  • 2
3
votes
1 answer

how to increase container width to fix GridView scroll in yii2

I am using yii2 GridView widget for showing data in form of table. As there are many fields to show, GridView ( below table ) showing scroll for it. But i don't want it. I want to increase container width so that it show table without scroll. I had…
Paritosh Mahale
  • 1,238
  • 2
  • 14
  • 42
3
votes
1 answer

How to create page with different forms in view(yii2)?

For example: We have table book with different types (Horror, Travel, History). We need to create a method update for these books, but for each book type we need to show different type of form. How can we achieve this? Is the following code…
Fitstd
  • 189
  • 2
  • 9
3
votes
1 answer

Yii2 - Submit Active-form only on click over submit button, not at pressing enter key

I'm working in an active form and adding some fields dynamically using a GridView, but when I have to filter data and I press the enter key (on GridView to begin filtering) the form is submitted. How to avoid "submitting" on press Enter key?
German_Kast
  • 169
  • 2
  • 11
3
votes
2 answers

Yii2: How to do a simple join query?

I am learning how to do simple queries using the Yii2 framework. I use PostgreSQL. I am trying to join two tables and get the data from both tables with a where condition. The tables are called Admins and Persons. The join use field called…
Roby Sottini
  • 2,117
  • 6
  • 48
  • 88
3
votes
2 answers

Codeception error "Class Yii not found" when trying to run

Currently working on a project for my apprenticeship. I have made some automated tests. I initialised codeception by running and built suite using codecept bootstrap codecept build These 2 commands worked as expected but when I try to run the tests…
Kyle
  • 667
  • 6
  • 28
3
votes
2 answers

Yii2 - how to get a current quarter without the past quarter?

I've a problem here. I need to get a quarter of the year without the past quarter. F.e: In my database I have a field created_at, which saves the timestamp of service created. I need to not involve those services, which was made in the past quarter.…
HELPME
  • 714
  • 14
  • 35
3
votes
0 answers

Not receiving any response from server after payment success - Authorize.Net yii2

I want to use Authorize.Net for payment but got stuck in middle. There is not any Error message, I am using SANDBOX for authCaptureTransaction, First I have created token with amount , return url. $response =…
Vi8L
  • 958
  • 10
  • 12
3
votes
1 answer

Yii2 - validating ISO8601 datetime format with DateValidator

I have a ISO8601 datetime value in the following format (generated by JS): var d = new Date(), dateString = d.toISOString(); // returns "2017-08-17T07:39:34.502Z" In my model, I want to create a validation rule to validate this value. I have…
3
votes
1 answer

How to set value in array helper Yii2?

I want to set value of array helper in Yii 2 as id (primary key of database). But when I use it shows me 0,1,2,3,.. not its real id number. Here is my array helper code: ' '),…
areff
  • 145
  • 3
  • 16
3
votes
1 answer

Components, Extension or Module in Yii 2?

I am new to yii and using version 2. I developed a project which uses a library (I coded) for parsing a CAD model file, extract vertexes, edges, faces etc, finally combine those entities to display the model and then extract features. It displays…
Minathe
  • 630
  • 1
  • 5
  • 21
3
votes
1 answer

Cannot install Kartik Dialog

This is my composer .json file { "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "*", "yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-swiftmailer": "*", "kartik-v/yii2-nav-x": "*", …
ron
  • 175
  • 3
  • 14