Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Remove code that had been retained for backwards compatibility #11541

Merged

Conversation

GuySartorelli
Copy link
Member

We don't need to retain this compatibility anymore. Some of this is dead code, and some is just tech debt that should have been properly deprecated.

Issue

@GuySartorelli GuySartorelli marked this pull request as draft January 9, 2025 01:09
Comment on lines -1344 to -1346
public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null)
public function loadDataFrom(object|array $data, int $mergeStrategy = 0, array $fieldList = [])
{
if (!is_object($data) && !is_array($data)) {
user_error("Form::loadDataFrom() not passed an array or an object", E_USER_WARNING);
return $this;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding strong typing here seems sensible.

  • object|array is already enforced for $data by the user_error.
  • int is now the only valid type for $mergeStrategy
  • array is already enforced for $fieldList by its use in in_array()

Comment on lines -210 to +212
// Always ensure that only pages with ShowInSearch = 1 can be searched
// Always ensure that only pages/files with ShowInSearch = 1 can be searched
$extraFilters[$pageClass] .= " AND ShowInSearch <> 0";

// File.ShowInSearch was added later, keep the database driver backwards compatible
// by checking for its existence first
$fileTable = DataObject::getSchema()->tableName($fileClass);
$fields = $this->getSchemaManager()->fieldList($fileTable);
if (array_key_exists('ShowInSearch', $fields ?? [])) {
$extraFilters[$fileClass] .= " AND ShowInSearch <> 0";
}
$extraFilters[$fileClass] .= " AND ShowInSearch <> 0";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That db column will always be present now.

We don't need to retain this compatibility anymore. Some of this is dead
code, and some is just tech debt that should have been properly
deprecated.
@GuySartorelli GuySartorelli marked this pull request as ready for review January 9, 2025 22:34
@emteknetnz emteknetnz merged commit cea977d into silverstripe:6.0 Jan 9, 2025
13 checks passed
@emteknetnz emteknetnz deleted the pulls/6.0/remove-bc branch January 9, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants