Check class from a relation, like hasManyClass("tickets") => "Ticket"

@param string $attr attribute to check

@return the class
510454
public static function hasManyClass($attr)
    {
        if (!self::hasHasMany($attr)) {
            return null;
        }

        $cls     = get_called_class();
        $configs = self::$_has_many[$cls][$attr];
        $klass   = is_array($configs) && array_key_exists("class_name", $configs)  ? $configs["class_name"] : ucfirst(preg_replace('/s$/', "", $attr));
        return $klass;
    }
764179
public static function setRelation(string $attr, array $params, $class)
    {
        if (!isset(self::$relationData[$class])) {
            self::$relationData[$class] = [];
        }
        self::$relationData[$class][$attr] = [$params]; //键名为未解析标记
    }
136907
protected function getAttrName($attr)
    {
        $name = strtolower($attr);
        if (array_key_exists($name, $this->_map)) {
            $attr = $this->_map[$name];
        }
        return $attr;
    }
535140
public function min($attr)
    {
        $builder = $this->_makeBuilderForAggregations(" min($attr) ");
        return $this->_executeAndReturnFirst($builder, $this->_vals);
    }
311489
public function setAttribute($attr, $value)
    {

        $attr = strtolower($attr);

        if(is_null($value)) {
            unset($this->attributes[$attr]);
        }
        else {
            $this->attributes[$attr] = $value;
        }

        return $this;

    }
455177
function(attr) {
        var value = this.get(attr);
        if (value) {
          if (!(value instanceof AV.Relation)) {
            throw new Error('Called relation() on non-relation field ' + attr);
          }
          value._ensureParentAndKey(this, attr);
          return value;
        } else {
          return new AV.Relation(this, attr);
        }
      }
557153
protected function _setActive(array $attr = [])
    {
        if ($this->Url->build(self::$_itemParams['item']['url']) == env('REQUEST_URI')) {
            $attr = $this->addClass($attr, 'active');
        }

        return $attr;
    }
1062482
public function get($attr,$current=true)
    {
        if (!$this->_data || !array_key_exists($attr, $this->_data)) {
            return null;
        }
        return Connection::convertToEncoding($current ? $this->_data[$attr] : $this->_prev_data[$attr]);
    }
1061939
public function getAttribute($attr)
    {
        switch($attr)
        {
        case \PDO::ATTR_AUTOCOMMIT:
            return $this->_autocommit;
        case \PDO::ATTR_DRIVER_NAME:
            return 'oci';
        case \PDO::ATTR_CASE:
            return $this->_case;
        }
        return null;
    }
74553
function getAttribute($attr)
    {
        $attr = strtolower($attr);
        if (isset($this->_attributes[$attr])) {
            return $this->_attributes[$attr];
        }
        return null;
    }
557903
public function form($attr = [])
    {
        $form = $this->helper->form($attr);
        if (isset($this->inputs['__csrf_token'])) {
            $form .= $this->helper->input($this->get('__csrf_token'));
        }

        return $form;
    }
431025
public static function isClassAttribute($className, $attrName)
    {
        if (!self::attributesSetFor($className)) {
            // # TODO: this logic doesn't make sense because the classes implementing
            // # AttributedModelTrait require a piece of code to register their attributes.
            // return false;
            throw new Exception\RuntimeException(
                sprintf("Attributes not set for class %s", $className)
            );
        }
        // return in_array($attrName, self::$classAttributes[$className]);
        return self::$classAttributes[$className]->exists($attrName);
    }
1119049
protected function initializeCategoryProduct(array $attr)
    {

        // try to load the category product relation with the passed category/product ID and merge it with the attributes
        if ($entity = $this->loadCategoryProduct($attr[MemberNames::CATEGORY_ID], $attr[MemberNames::PRODUCT_ID])) {
            return $this->mergeEntity($entity, $attr);
        }

        // otherwise simply return the attributes
        return $attr;
    }
385727
public function unique($attr = 'id')
    {
        $checked = array();
        foreach ($this->members() as $k => $obj) {
            if (in_array($obj->$attr, $checked))
                unset($this->members[$k]);
            else
                $checked[] = $obj->$attr;
        }
        return $this;
    }
1234176
public function get_session($attr = null){
    if ( $this->session->has(self::$un) ){
      return $attr ? $this->session->get(self::$un, $attr) : $this->session->get(self::$un);
    }
  }
498456
public function getAttribute($attr, $default = null) {
		
		return ($attr && array_key_exists($attr, $this->attributes)) ? $this->attributes[$attr] : $default;
		
	}
525864
protected function initializeProductRelation(array $attr)
    {

        // laod child/parent ID
        $childId = $attr[MemberNames::CHILD_ID];
        $parentId = $attr[MemberNames::PARENT_ID];

        // query whether or not the product relation already exists
        if ($this->loadProductRelation($parentId, $childId)) {
            return;
        }

        // simply return the attributes
        return $attr;
    }