Resolve has many ids

@param string $attr   attribute name
@param mixed  $values to resolve

@return ids
178696
private function _resolveIds($attr, $values=null)
    {
        $cls = get_called_class();

        if (!array_key_exists($cls, self::$_has_many_maps)
            || !array_key_exists($attr, self::$_has_many_maps[$cls])
        ) {
            return null;
        }

        $klass   = self::hasManyClass(self::$_has_many_maps[$cls][$attr]);
        $foreign = self::hasManyForeignKey(Inflections::pluralize(strtolower($klass)));
        $value   = $this->_data[self::getPK()];
        $klasspk = $klass::getPK();

        // if values sent, set them
        if ($values) {
            $this->_has_many_ids = $values;
            $ids = join(",", $values);
            $this->_nullNotPresentIds($klass, $foreign, $ids, $value);
        } else {
            $data = $klass::where(array($foreign => $value));
            $this->_has_many_ids = array();
            while ($row=$data->next()) {
                array_push($this->_has_many_ids, $row->get($klasspk));
            }
        }
        return $this->_has_many_ids;
    }
1300007
public function attr($attr)
    {
        $data = [];

        foreach ($this->_nodes as $node) {
            $data[] = $node->getAttribute($attr);
        }

        return $data;
    }
833861
public function attr(Array $attr = [])
    {
        if( isset($this->settings['attr']) && is_array($this->settings['attr']) )
        {
            $settings = $this->settings['attr'];
        }
        else
        {
            $settings = [];
        }

        $this->settings['attr'] = array_merge($settings, $attr);

        return $this;
    }
1180623
private function _set_session($attr){
    if ( $this->session->has(self::$sn) ){
      $args = \func_get_args();
      if ( (\count($args) === 2) && \is_string($args[0]) ){
        $attr = [$args[0] => $args[1]];
      }
      foreach ( $attr as $key => $val ){
        if ( \is_string($key) ){
          $this->session->set($val, self::$sn, $key);
        }
      }
    }
    return $this;
  }
1299162
public function allCategoryValues($values, $attribute = null)
    {
        $model = new $this->owner->modelClass();

        return $this->anyCategoryValues($values, $attribute)->andHaving(new Expression('COUNT(*) = ' . count($model->filterCategoryValues($values))));
    }
501335
public function prepare(&$attrs)
    {
        $attrs['type'] = $this->type ?: 'text';
        $attrs['name'] = $this->getFieldName();
        $attrs['id'] = $this->getAttribute('id', $this->getId());
        $attrs['class'] = $this->getAttribute('class');
        $attrs['placeholder'] = $this->getAttribute('placeholder');
        $attrs['size'] = $this->getAttribute('size');
        $attrs['maxlength'] = $this->getAttribute('maxlength');
        $attrs['readonly'] = $this->getAttribute('readonly');
        $attrs['disabled'] = $this->getAttribute('disabled');
        $attrs['autofocus'] = $this->getAttribute('autofocus');
        $attrs['autocomplete'] = $this->getAttribute('autocomplete');
        $attrs['form'] = $this->getAttribute('form');
        $attrs['formenctype'] = $this->getAttribute('formenctype');
        $attrs['formmethod'] = $this->getAttribute('formmethod');
        $attrs['formnovalidate'] = $this->getAttribute('formnovalidate');
        $attrs['formtarget'] = $this->getAttribute('formtarget');
        $attrs['onchange'] = $this->getAttribute('onchange');
        $attrs['onfocus'] = $this->getAttribute('onfocus');
        $attrs['onblur'] = $this->getAttribute('onblur');
        $attrs['value'] = $this->escape($this->getValue());
        $attrs['list'] = $this->getAttribute('list', count($this->options) ? $this->getId() . '-list' : null);

        $attrs['required'] = $this->required;
    }
1131164
protected function initializeAttribute(array $attr)
    {

        // try to load the attribute with the passed attribute ID and merge it with the attributes
        if (isset($this->attributes[$attributeId = (integer) $attr[MemberNames::ATTRIBUTE_ID]])) {
            return $this->mergeEntity($this->attributes[$attributeId], $attr);
        }

        // otherwise simply return the attributes
        return $attr;
    }
120600
public function setAttributes(array $attr)
    {
        foreach ($attr as $key => $value) {
            $this->setAttribute($key, $value);
        }

        return $this;
    }
748048
private static function _resolveHasMany($attr, $value)
    {
        $cls = get_called_class();
        if (!self::hasHasMany($attr)) {
            return null;
        }

        $configs       = self::$_has_many[$cls][$attr];
        $has_many_cls  = self::hasManyClass($attr);
        $this_key      = self::hasManyForeignKey($attr);
        $collection    = $has_many_cls::where(array($this_key => $value));
        return $collection;
    }
984655
private function deleteFiles($attr)
    {
        $base = $this->getSavePath($attr);
        /* @var $model ActiveRecord */
        $model = $this->owner;
        if ($model->isNewRecord) {
            $value = $model->{$attr};
        } else {
            $value = $model->oldAttributes[$attr];
        }
        $file = $base . $value;

        if (is_file($file)) {
            unlink($file);
        }
    }
762341
public function setInterfaceTrans($attr, $value = null)
    {
        if (is_array($attr))
            $this->interfaceTrans = array_merge($this->interfaceTrans, $attr);
        else
            $this->interfaceTrans[$attr] = $value;

        return $this;
    }
581612
public function prepare(&$attrs)
    {
        $attrs['id'] = $this->getAttribute('id', $this->getId());
        $attrs['class'] = $this->getAttribute('class');
    }
384069
public function setAttrs(array $attrs) {
		foreach ($attrs as $attr => $value) {
			$this->setAttr($attr, $value);
		}
		
		return $this;
	}
430852
public function attr($name, $value = null)
    {
        $attrs = (array) $this->getAttribute('attribs');

        if ($value === null) {
            return isset($attrs[$name]) ? $attrs[$name] : null;
        }

        $attrs[$name] = $value;

        $this->setAttribute('attribs', $attrs);

        return $this;
    }
972335
protected function getAttributesCSS(array $attr)
    {
        $output = [];
        foreach ($attr as $key => $values) {
            if (in_array($key, $this->attributesCss) && $values !== '') {
                $output[] = $key . '="' . $values . '"';
            }
        }
        $implode = implode(' ', $output);

        return $implode
            ? " $implode"
            : '';
    }
1052179
public function updateAttributes($attrs)
    {
        if (array_key_exists(self::getPK(), $attrs)) {
            unset($attrs[self::getPK()]);
        }
        foreach ($attrs as $attr => $value) {
            $this->_data[$attr] = $value;
        }
        return $this->save();
    }
758186
public function relatedByCategoryValues($values, $attribute = null)
    {
        return $this->anyCategoryValues($values, $attribute)->addOrderBy(new Expression('COUNT(*) DESC'));
    }