Page MenuHomePhabricator

Investigate need for &$byref in CRUD and PersistentVisitor
Closed, ResolvedPublic

Description

Some methods in the CRUD pattern use &$byref function parameters. Do we need all of them?

Event Timeline

kalle set the point value for this task to 4.
kalle renamed this task from Investigate need for &$byref in CRUD to Investigate need for &$byref in CRUD and PersistentVisitor.Nov 11 2020, 12:50 PM

From spending a bit of time testing:

We do need to pass arrays as byref, e.g. in CRUDs when serializing persistent instances to an array which is then sent to the database connection for creating and updating a row. If not, we'll be modifying a new clone of the array which is then thrown away.

We do not need to pass instances of Persistent as byref in order to modify the instance passed down by the caller. This would remove the bulk of all byrefs, e.g. all visitors.

This will be implemented when ApiCRUD is merged.

Change 643508 had a related patch set uploaded (by Karl Wettin (WMSE); owner: Karl Wettin (WMSE)):
[mediawiki/extensions/WikispeechSpeechDataCollector@master] Remove use of &$byref from CRUD

https://gerrit.wikimedia.org/r/643508

This patch is for CRUD only. PersistentVisitor-refactor will occur in a new patch attached to this task once ApiCRUD has been merged.

kalle changed the point value for this task from 4 to 1.Nov 26 2020, 11:07 AM

Change 643508 merged by jenkins-bot:
[mediawiki/extensions/WikispeechSpeechDataCollector@master] Remove use of &$byref from CRUD

https://gerrit.wikimedia.org/r/643508

Change 646972 had a related patch set uploaded (by Karl Wettin (WMSE); owner: Karl Wettin (WMSE)):
[mediawiki/extensions/WikispeechSpeechDataCollector@master] Remove &$byref from PersistentVisitor functions

https://gerrit.wikimedia.org/r/646972

Change 646972 merged by jenkins-bot:
[mediawiki/extensions/WikispeechSpeechDataCollector@master] Remove &$byref from PersistentVisitor functions

https://gerrit.wikimedia.org/r/646972

Lokal_Profil removed the point value for this task.