sam-it/yii2-magic

Improvements to Yii2 framework.

Maintainers

👁 SamMousa

Package info

github.com/SAM-IT/yii2-magic

Type:yii2-extension

pkg:composer/sam-it/yii2-magic

Statistics

Installs: 74 359

Dependents: 1

Suggesters: 0

Stars: 18

Open Issues: 1

v5.0.0 2020-10-02 12:05 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT a3c48f2cd5cc2022d8201f1fef23c36aa3d5fccf

  • Sam Mousa <sam.woop@mousa.nl>
  • Joey Claessen <joey_claessen.woop@hotmail.com>

README

👁 Latest Stable Version
👁 Total Downloads
👁 Latest Unstable Version
👁 License
👁 Monthly Downloads
👁 Daily Downloads

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.