Cannot read properties of undefined strapi.entityValidator.validateEntityCreation

[details=“System Information”]

  • Strapi Version: 4.2.2
  • Operating System: Windows
  • Database: MYSQL
  • Node Version: 16.13.1
  • NPM Version: -
  • Yarn Version: -
    I have created a new collection called “order”. To save new data from backend i am validating the model created
const validateData = await strapi.entityValidator.validateEntityCreation(
        strapi.models.order, //here is the error
        data //array with data to save
      );
const entry = await strapi.query("order").create(validateData);

but i receive an error like this Cannot read properties of undefined (reading 'order')

I am using MYSQL


So i think that
validateEntityCreation takes 3 arguments ?
The model const model = strapi.contentTypes[("api::something.something")];
the data and options
Also, I don’t think you query like that you want to query with the same as above api::something.something