I think what you actually want may be:
$modx->getChildIds($id) and modx->getParentIds($id).
The getChildIds() method returns an array containing any children of the specified resource. Similarly, the getParentIds() method returns an array containing the IDs of all ancestors up the tree. If there are none, you’ll get back an empty array. If you need to know how many there are, you can use count() on the return value.
BTW, there is a hasChildren() method, but it is a method of the resource object, not the $modx object. To see if the current resource has children:
if ($modx->resource->hasChildren()) {
/* yes there are children */
} else {
/* no children */
}