Breaking: Extended JobRepository method signatures 

Description 

To support the new Show hidden records plugin option, \FGTCLB\AcademicJobs\Domain\Repository\JobRepository changed one method and gained two:

  • findByJobType(int $jobType, bool $includeHidden = false): QueryResultInterface . The optional parameter $includeHidden was appended.
  • findAllJobs(bool $includeHidden = false): QueryResultInterface is new. The job list calls it without a job type instead of the inherited findAll() , so the option is honoured there as well.
  • findUidsWithHiddenDefaultRecord(array $uids): array is new. It returns the uids of the given jobs whose record in the default language is hidden, which the job list uses to leave those jobs unlinked.

With $includeHidden set to true , the query ignores only the hidden flag of the jobs. Deleted records, start and end time and frontend user groups still apply.

Impact 

Calls of the repository keep working: the new parameter has a default value.

A class that extends JobRepository and overrides findByJobType() with the old signature fails with a PHP fatal error, because the method of the subclass no longer accepts every parameter of the parent method. A subclass that already declares a method findAllJobs() or findUidsWithHiddenDefaultRecord() with another signature fails the same way.

Affected Installations 

Installations that extend \FGTCLB\AcademicJobs\Domain\Repository\JobRepository and override findByJobType() , or declare one of the two new methods. All other installations are unaffected.

Migration 

Add the parameter to the overriding method and pass it on:

public function findByJobType(int $jobType, bool $includeHidden = false): QueryResultInterface
{
    // ...
    return parent::findByJobType($jobType, $includeHidden);
}
Copied!

Rename a method of the subclass that collides with one of the new methods.