Get model id from model instance

Is it possible to get the model name / identifier from an instance of this model? I would like to be able to pass a model to a service, and this service takes action on this model based on what type of model it has.

+5
source share
1 answer

In lifecycle callbacks, for example, you can access the model identifier with:

this.adapter.identity; 
+3
source

Source: https://habr.com/ru/post/1212724/


All Articles