These docs are for an old release. Info on upgrading to v5

Resource::getParent

Returns the parent Resource of a child resource.

resource.getParent()

If the resource does not have a parent because it is already a top-level resource, the result will be null.