Mail: [email protected] Phone: +1(628) 800-7750
Everything you need to know about NexoPOS.
The model's dependency has been introduced on NexoPOS 4.7.x and that mainly helps to prevent resources deletion that is required by other models. Technically this means that before deleting a category NexoPOS will check if there is a product assigned to that category to prevent the deletion.
This guide explains how the model dependency works on NexoPOS.
This should be made on the model itself. We state on the model which other model has a dependency on him. A model might be dependency on many other models. Every dependency should be clearly defined to prevent deletion.
To declare a dependency, we need to declare a protected property named "isDependencyFor" like this.
That property accepts as key the model class which depends on the current model and the configuration as the value.
Here are the supported values for each dependency:
As our model is "Category", and we declared that to be a dependency for "Product". Here is the final form of our configuration.
While trying to delete, you'll end up with the following error.
In case a dependency has been found.