Hello,
We have a code where we are creating the relationships between two objects, and we want the posts to be deleted if the relationship are not created due to the second object non existence.
private function create_relationship(String $yearId, String $modelId): bool {
return \MB_Relationships_API::add($yearId, $modelId, 'yearModel', 1, 1);
}
However, this function returns true, even when we force an inexistent ID. Going to the WordPress interface we checked that the object does not have any object related on the select box of the relationship. We also tried to validate with the following code:
\MB_Relationships_API::has($modelId, $brandId, 'modelBrand');
Why does it happen? Is there a way we can be sure the relationship will not be created?