This adds a remove() method, which is just a wrapper for JsonPath::remove, and also an magic __unset() method that attempts to unset a property using remove(). Both will validate before modifying the object.
So we can do on the following:
{
"field1": "foo",
"field2": "bar"
}
$rootedDataObject->remove("$", "field2");
unset($rootedDataObject->{"$.field2");
Either will result in:
{
"field1": "foo",
}
Also updates to latest release of JsonPath library.
This adds a remove() method, which is just a wrapper for JsonPath::remove, and also an magic __unset() method that attempts to unset a property using remove(). Both will validate before modifying the object.
So we can do on the following:
$rootedDataObject->remove("$", "field2");
unset($rootedDataObject->{"$.field2");
Either will result in:
Also updates to latest release of JsonPath library.