Snaps in php

php

web programming language

php

second parameter defines a size of the chunked subarrays. third parameter defines if originale keys should be preserved in chunked arrays. array chunk returns array with chunked subarrays...

php array chunks

php

php - change key case with array_change_key_case function...

php array case

php

php - get items from array which index starting with given prefix with array_intersect_key function...

array php

yii2 - instantiate model class from variable...

yii2 model

php

Php switch syntax...

php switch

tables: expression -------------- id, expression expression_type ---------------------- id, name Find all records from expression table with expression_type name 'math'...

yii2 active-record-query

yii2 - get current module controller and action on view...

php yii2 url route action

Get distinct records with for example name from workers table:...

php yii2 activerecord select distinct

php

access class privvate property through getter method...

php getter private property

To create module migration in module folder --migrationPath can be used. In console navigate to project root and use following command to create migration file....

yii2 migration module console

TimestampBehavior to autmatically set datetime values of created_at and updated_at. If fields have other name than default, names can be overwite...

php yii2 activerecord datetime

To automatically set created_at and updated_at TimestampBehavior can be used. In model extending ActiveRecord put following lines:...

php yii2 date activerecord

php

If class name if for example string class methods can be read with ReflectionClass like this...

php class methods reflection

To solve this error translation configuration must be added to config. In config/web.php add folowing array in 'components' array....

php yii2 translation array

php

Checking if file in $_FILES is an image....

php

Creating module in yii2 can be done in two difrent ways: 1. manually 2. by gii generator Assuming the framework is installed and running and we want to create module called: 'examplemodule'...

php framework yii2 module

Steps for installing Yii2 framework with composer:...

yii2 framework composer

To remove index.php from url:...

php yii2 url

To enable pretty (SEO friendly) url's edit configuration file as follows: For basic yii2 template Edit /config/web.php and add entry into components array like this:...

php yii2 url

When switchery plugin is implemented correctly all what is needed is:...

yii2 checkbox active-form