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;
    }
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;
    }
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 ; }
Resolve has many ids

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

@return ids
Resolve has many ids