yii\behaviors\AttributeTypecastBehavior::attach PHP Méthode

attach() public méthode

public attach ( $owner )
    public function attach($owner)
    {
        parent::attach($owner);
        if ($this->attributeTypes === null) {
            $ownerClass = get_class($this->owner);
            if (!isset(self::$autoDetectedAttributeTypes[$ownerClass])) {
                self::$autoDetectedAttributeTypes[$ownerClass] = $this->detectAttributeTypes();
            }
            $this->attributeTypes = self::$autoDetectedAttributeTypes[$ownerClass];
        }
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function attach($owner)
 {
     parent::attach($owner);
     if ($this->attributeTypes === null) {
         $this->reinitAutoDetectedAttributeTypes();
     }
 }