private function ensureParentAndKey($parent, $key)
    {
        if (!$this->parent)
        {
            $this->parent = $parent;
        }
        if (!$this->key)
        {
            $this->key = $key;
        }
        if ($this->parent != $parent)
        {
            throw new \Exception('Internal Error. Relation retrieved from two different Objects.');
        }
        if ($this->key != $key)
        {
            throw new \Exception('Internal Error. Relation retrieved from two different keys.');
        }
    }
private function ensureParentAndKey($parent, $key)
    {
        if (!$this->parent)
        {
            $this->parent = $parent;
        }
        if (!$this->key)
        {
            $this->key = $key;
        }
        if ($this->parent != $parent)
        {
            throw new \Exception('Internal Error. Relation retrieved from two different Objects.');
        }
        if ($this->key != $key)
        {
            throw new \Exception('Internal Error. Relation retrieved from two different keys.');
        }
    }
private function ensureParentAndKey ( $ parent , $ key ) { if ( ! $ this -> parent ) { $ this -> parent = $ parent ; } if ( ! $ this -> key ) { $ this -> key = $ key ; } if ( $ this -> parent != $ parent ) { throw new \ Exception ( 'Internal Error. Relation retrieved from two different Objects.' ) ; } if ( $ this -> key != $ key ) { throw new \ Exception ( 'Internal Error. Relation retrieved from two different keys.' ) ; } }
Makes sure that this relation has the right parent and key.

@param $parent
@param $key

@throws \Exception
Makes sure that this relation has the right parent and key .