Open sumaiyamannan opened 3 months ago
Hi, I see that in places global $DB is not used directly but instead $this->database is employed. This is not necessary. It is advisable to directly use Data manipulation API (https://moodledev.io/docs/4.5/apis/core/dml)
For e.g. https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L35 https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L63 https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/content_repository.php#L51
Use this global $DB; $DB->start_delegated_transaction(); Instead of $this->database->start_delegated_transaction();
https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L40 https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L63
And use this global $DB; $DB->get_records instead of $this->database->get_records
And other similar usages can be updated as well.
Regards, Sumaiya
Hi, I see that in places global $DB is not used directly but instead $this->database is employed. This is not necessary. It is advisable to directly use Data manipulation API (https://moodledev.io/docs/4.5/apis/core/dml)
For e.g. https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L35 https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L63 https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/content_repository.php#L51
https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L40 https://github.com/ispringsolutions/moodle-mod_ispring/blob/main/classes/local/content/infrastructure/query/content_query_service.php#L63
And other similar usages can be updated as well.
Regards, Sumaiya