zircote / Hal

A PHP implementation of HAL http://stateless.co/hal_specification.html
93 stars 6 forks source link

_getEmbRes throws fatal error when it can't find self #15

Open logistiker opened 11 years ago

logistiker commented 11 years ago

$this->links['_self'] only exists at the top level to describe the current resource. It does not exist within embedded resources. There's a Link type check when _getEmbRes calls getXml which then calls setXMLAttributes and tries to call $this->getSelf() which will not return anything in this case. A null is not of the same type as Link.

logistiker commented 11 years ago

oops, apparently I was wrong about self. It can be in embedded resources. I think though if it doesn't exist, then an exception should be thrown and not a fatal error.

hjr3 commented 10 years ago

This is def a bug. I am not sure it is even possible not to provide a self link given the API though.