private function _resolveCollection($attr, $values)
    {
        $cls = get_called_class();

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

        $maps = array_values(self::$_has_many_maps[$cls]);
        if (!in_array($attr, $maps)) {
            return null;
        }

        if (!$values || !is_array($values) || sizeof($values)<1 || !is_object($values[0])) {
            return null;
        }

        $this->_has_many_ids = array();

        foreach ($values as $value) {
            $klass = get_class($value);
            $this->push($value);
            $id = $value->get($klass::getPK());
            if ($id) {
                array_push($this->_has_many_ids, $id);
            }
        }
        return $this->_has_many_ids;
    }