private function _resolveHasOne($attr, $value)
    {
        $cls = get_called_class();
        if (!array_key_exists($cls, self::$_has_one)
            || !array_key_exists($attr, self::$_has_one[$cls])
        ) {
            return null;
        }

        if (array_key_exists($attr, $this->_has_one_cache) && $this->_has_one_cache[$attr]) {
            return $this->_has_one_cache[$attr];
        }

        $configs       = self::$_has_one[$cls][$attr];
        $has_one_cls   = is_array($configs) && array_key_exists("class_name", $configs)  ? $configs["class_name"]  : ucfirst(preg_replace('/s$/', "", $attr));
        $this_key      = is_array($configs) && array_key_exists("foreign_key", $configs) ? $configs["foreign_key"] : (self::isIgnoringCase() ? strtolower($cls)."_id" : $cls."_id");
        $obj           = $has_one_cls::first(array($this_key=>$value));

        if ($obj) {
            $this->_has_one_cache[$attr] = $obj;
        }
        return $obj;
    }
private function _resolveHasOne($attr, $value)
    {
        $cls = get_called_class();
        if (!array_key_exists($cls, self::$_has_one)
            || !array_key_exists($attr, self::$_has_one[$cls])
        ) {
            return null;
        }

        if (array_key_exists($attr, $this->_has_one_cache) && $this->_has_one_cache[$attr]) {
            return $this->_has_one_cache[$attr];
        }

        $configs       = self::$_has_one[$cls][$attr];
        $has_one_cls   = is_array($configs) && array_key_exists("class_name", $configs)  ? $configs["class_name"]  : ucfirst(preg_replace('/s$/', "", $attr));
        $this_key      = is_array($configs) && array_key_exists("foreign_key", $configs) ? $configs["foreign_key"] : (self::isIgnoringCase() ? strtolower($cls)."_id" : $cls."_id");
        $obj           = $has_one_cls::first(array($this_key=>$value));

        if ($obj) {
            $this->_has_one_cache[$attr] = $obj;
        }
        return $obj;
    }
private function _resolveHasOne ( $ attr , $ value ) { $ cls = get_called_class ( ) ; if ( ! array_key_exists ( $ cls , self :: $ _has_one ) || ! array_key_exists ( $ attr , self :: $ _has_one [ $ cls ] ) ) { return null ; } if ( array_key_exists ( $ attr , $ this -> _has_one_cache ) && $ this -> _has_one_cache [ $ attr ] ) { return $ this -> _has_one_cache [ $ attr ] ; } $ configs = self :: $ _has_one [ $ cls ] [ $ attr ] ; $ has_one_cls = is_array ( $ configs ) && array_key_exists ( "class_name" , $ configs ) ? $ configs [ "class_name" ] : ucfirst ( preg_replace ( '/s$/' , "" , $ attr ) ) ; $ this_key = is_array ( $ configs ) && array_key_exists ( "foreign_key" , $ configs ) ? $ configs [ "foreign_key" ] : ( self :: isIgnoringCase ( ) ? strtolower ( $ cls ) . "_id" : $ cls . "_id" ) ; $ obj = $ has_one_cls :: first ( array ( $ this_key => $ value ) ) ; if ( $ obj ) { $ this -> _has_one_cache [ $ attr ] = $ obj ; } return $ obj ; }
Resolve the has one association and returns the object

@param string $attr  name
@param mixed  $value to use

@return collection
Resolve the has one association and returns the object