public function hasOne($id, JSONSimpleStorage $object, $foreignId) {
        // init one filed
        if (!isset($this->one[$id])) {
            $this->one[$id] = [];
        }
        
        // init many field
        if (!isset($object->many[$foreignId])) {
            $object->many[$foreignId] = [];
            $object->many[$foreignId][$this->class] = [];
        } else if (!isset($object->many[$foreignId][$this->class])) {
            $object->many[$foreignId][$this->class] = [];
        }
        
        // set fields
        $this->one[$id][$object->class] = $foreignId;
        if (!in_array($id, $object->many[$foreignId][$this->class])) {
            $object->many[$foreignId][$this->class][] = $id;
        }
        
        // set dirty objects
        self::$dirty[$object->class] = true;
        self::$dirty[$this->class] = true;
    }