public function newDoc($profile, $initDoc = null)
    {
        $doc = new CollectionDocJson(null, $this->_auth);
        if ($initDoc) {
            $doc->setDocument($initDoc);
        }

        // get the profile link
        $urn = self::FETCH_PROFILE;
        $link = $this->home->link($urn);
        if (empty($link)) {
            throw new LinkException("Unable to find link $urn in home doc");
        }
        $href = $link->expand(['guid' => $profile]);

        // set the link
        $doc->links->profile = [new \StdClass()];
        $doc->links->profile[0]->href = $href;
        return $doc;
    }
public function newDoc($profile, $initDoc = null)
    {
        $doc = new CollectionDocJson(null, $this->_auth);
        if ($initDoc) {
            $doc->setDocument($initDoc);
        }

        // get the profile link
        $urn = self::FETCH_PROFILE;
        $link = $this->home->link($urn);
        if (empty($link)) {
            throw new LinkException("Unable to find link $urn in home doc");
        }
        $href = $link->expand(['guid' => $profile]);

        // set the link
        $doc->links->profile = [new \StdClass()];
        $doc->links->profile[0]->href = $href;
        return $doc;
    }
public function newDoc ( $ profile , $ initDoc = null ) { $ doc = new CollectionDocJson ( null , $ this -> _auth ) ; if ( $ initDoc ) { $ doc -> setDocument ( $ initDoc ) ; } // get the profile link $ urn = self :: FETCH_PROFILE ; $ link = $ this -> home -> link ( $ urn ) ; if ( empty ( $ link ) ) { throw new LinkException ( "Unable to find link $urn in home doc" ) ; } $ href = $ link -> expand ( [ 'guid' => $ profile ] ) ; // set the link $ doc -> links -> profile = [ new \ StdClass ( ) ] ; $ doc -> links -> profile [ 0 ] -> href = $ href ; return $ doc ; }
Create a new doc

@param string $profile the profile alias (or guid)
@param array $initDoc optional initial doc payload
@return CollectionDocJson a new (unsaved) doc
Create a new doc