public static function fromContext($context, $ltiResourceLinkId, $tempId = null)
    {

        $resourceLink = new ResourceLink();
        $resourceLink->setContextId($context->getRecordId());
        $resourceLink->context = $context;
        $resourceLink->dataConnector = $context->getDataConnector();
        $resourceLink->ltiResourceLinkId = $ltiResourceLinkId;
        if (!empty($ltiResourceLinkId)) {
            $resourceLink->load();
            if (is_null($resourceLink->id) && !empty($tempId)) {
                $resourceLink->ltiResourceLinkId = $tempId;
                $resourceLink->load();
                $resourceLink->ltiResourceLinkId = $ltiResourceLinkId;
            }
        }

        return $resourceLink;

    }
public static function fromContext($context, $ltiResourceLinkId, $tempId = null)
    {

        $resourceLink = new ResourceLink();
        $resourceLink->setContextId($context->getRecordId());
        $resourceLink->context = $context;
        $resourceLink->dataConnector = $context->getDataConnector();
        $resourceLink->ltiResourceLinkId = $ltiResourceLinkId;
        if (!empty($ltiResourceLinkId)) {
            $resourceLink->load();
            if (is_null($resourceLink->id) && !empty($tempId)) {
                $resourceLink->ltiResourceLinkId = $tempId;
                $resourceLink->load();
                $resourceLink->ltiResourceLinkId = $ltiResourceLinkId;
            }
        }

        return $resourceLink;

    }
public static function fromContext ( $ context , $ ltiResourceLinkId , $ tempId = null ) { $ resourceLink = new ResourceLink ( ) ; $ resourceLink -> setContextId ( $ context -> getRecordId ( ) ) ; $ resourceLink -> context = $ context ; $ resourceLink -> dataConnector = $ context -> getDataConnector ( ) ; $ resourceLink -> ltiResourceLinkId = $ ltiResourceLinkId ; if ( ! empty ( $ ltiResourceLinkId ) ) { $ resourceLink -> load ( ) ; if ( is_null ( $ resourceLink -> id ) && ! empty ( $ tempId ) ) { $ resourceLink -> ltiResourceLinkId = $ tempId ; $ resourceLink -> load ( ) ; $ resourceLink -> ltiResourceLinkId = $ ltiResourceLinkId ; } } return $ resourceLink ; }
Class constructor from context.

@param Context $context Context object
@param string $ltiResourceLinkId Resource link ID value
@param string $tempId Temporary Resource link ID value (optional, default is null)
@return ResourceLink
Class constructor from context .