sam-it / yii2-magic
Improvements to Yii2 framework.
Installs: 56 111
Dependents: 1
Suggesters: 0
Security: 0
Stars: 18
Watchers: 3
Forks: 2
Open Issues: 1
Type:yii2-extension
Requires
- yiisoft/yii2: ^2.0.13
README
yii2-magic
Improvements for Yii2 that make it more "magic".
ActionInjectionTrait
Use this trait in your controller to get dependency injection in controller actions.
use \SamIT\Yii2\Traits\ActionInjectionTrait;
HighlightUnsafeAttributesTrait
Use this trait in your form to highlight unsafe attributes.
use \SamIT\Yii2\Traits\HighlightUnsafeAttributesTrait;
SingleTableInheritanceTrait
Use this trait in your active record model to implement single table inheritance.
use \SamIT\Yii2\Traits\SingleTableInheritanceTrait;
protected static function inheritanceConfig()
{
return [
'map' => [
PartnerProject::class => 'partner'
],
'column' => 'type'
];
}
This trait uses a different query object. If you use your own ActiveQuery
implementation, use SingleTableInheritanceQueryTrait
.