OEModule\PASAPI\resources\BaseResource::fromResourceId PHP Method

fromResourceId() public static method

Instantiate the resource from the external ID.
public static fromResourceId ( $version, $id ) : BaseResource
$version
$id
return BaseResource
    public static function fromResourceId($version, $id)
    {
        $finder = new PasApiAssignment();
        $assignment = $finder->findByResource(static::$resource_type, $id, static::$model_class);
        if ($model = $assignment->getInternal()) {
            if (!$model->isNewRecord) {
                $obj = new static($version);
                $obj->setAssignment($assignment);
                return $obj;
            }
        }
    }