src/mako/database/midgard/ORM.php
protected function registerTraits(): void
	{
		if(!isset(static::$traitHooks[static::class]))
		{
			static::$traitHooks[static::class] = [];
			static::$traitCasts[static::class] = [];

			foreach(ClassInspector::getTraits(static::class) as $trait)
			{
				if(method_exists($this, $getter = 'get' . $this->getClassShortName($trait) . 'Hooks'))
				{
					static::$traitHooks[static::class] = array_merge_recursive(static::$traitHooks[static::class], $this->$getter());
				}

				if(method_exists($this, $getter = 'get' . $this->getClassShortName($trait) . 'Casts'))
				{
					static::$traitCasts[static::class] += $this->$getter();
				}
			}
		}

		$this->cast += static::$traitCasts[static::class];
	}
protected function registerTraits(): void
	{
		if(!isset(static::$traitHooks[static::class]))
		{
			static::$traitHooks[static::class] = [];
			static::$traitCasts[static::class] = [];

			foreach(ClassInspector::getTraits(static::class) as $trait)
			{
				if(method_exists($this, $getter = 'get' . $this->getClassShortName($trait) . 'Hooks'))
				{
					static::$traitHooks[static::class] = array_merge_recursive(static::$traitHooks[static::class], $this->$getter());
				}

				if(method_exists($this, $getter = 'get' . $this->getClassShortName($trait) . 'Casts'))
				{
					static::$traitCasts[static::class] += $this->$getter();
				}
			}
		}

		$this->cast += static::$traitCasts[static::class];
	}
protected function registerTraits ( ) : void { if ( ! isset ( static :: $ traitHooks [ static :: class ] ) ) { static :: $ traitHooks [ static :: class ] = [ ] ; static :: $ traitCasts [ static :: class ] = [ ] ; foreach ( ClassInspector :: getTraits ( static :: class ) as $ trait ) { if ( method_exists ( $ this , $ getter = 'get' . $ this -> getClassShortName ( $ trait ) . 'Hooks' ) ) { static :: $ traitHooks [ static :: class ] = array_merge_recursive ( static :: $ traitHooks [ static :: class ] , $ this -> $ getter ( ) ) ; } if ( method_exists ( $ this , $ getter = 'get' . $ this -> getClassShortName ( $ trait ) . 'Casts' ) ) { static :: $ traitCasts [ static :: class ] += $ this -> $ getter ( ) ; } } } $ this -> cast += static :: $ traitCasts [ static :: class ] ; }
Registers traits.
Registers traits .