File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
developer_manual/app_publishing_maintenance/app_upgrade_guide Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -124,3 +124,33 @@ Removed APIs
124124 deprecated since Nextcloud 20 and were now removed. Instead use ``\OCP\Search\SearchResult `` and
125125 ``\OCP\Search\IProvider ``, available since Nextcloud 20.
126126- The ``\OC_Util::runningOnMac() `` method was removed. Instead you can just check ``PHP_OS_FAMILY === 'Darwin' ``.
127+ - The ``\OCP\DB\IQueryBuilder::execute `` method was deprecated since Nextcloud 22 and was now removed.
128+ Instead use the ``\OCP\DB\IQueryBuilder::executeQuery `` when doing executing a ``SELECT `` query and ``\OCP\DB\IQueryBuilder::executeStatement ``
129+ method when executing a ``UPDATE ``, ``INSERT `` and ``DELETE `` statement, available since Nextcloud 20.
130+
131+ Instead of catching a exceptions from the Doctrine DBAL package, you now need to catch ``OCP\DB\Exception ``
132+ and check the `getReason``. For example, the following old code:
133+
134+ .. code-block :: php
135+
136+ try {
137+ $qb->insert(...);
138+ $qb->execute();
139+ } catch (\Doctrine\DBAL\Exception\UniqueConstraintViolationException) {
140+ // Do stuff
141+ }
142+
143+ Should be replaced by the following code:
144+
145+ .. code-block :: php
146+
147+ try {
148+ $qb->insert(...);
149+ $qb->executeStatement();
150+ } catch (\Doctrine\DBAL\Exception\UniqueConstraintViolationException) {
151+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
152+ throw $e;
153+ }
154+
155+ // Do stuff
156+ }
You can’t perform that action at this time.
0 commit comments