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

setCellValueByColumnAndRow deprecated?? #3930

Open
spectoras opened this issue Mar 2, 2024 · 4 comments
Open

setCellValueByColumnAndRow deprecated?? #3930

spectoras opened this issue Mar 2, 2024 · 4 comments

Comments

@spectoras
Copy link

Hello fellows,
I am trying to use the library on one of my projects and when i tried to use setCellValueByColumnAndRow it says the following:

Fatal error: Uncaught Error: Call to undefined method PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setCellValueByColumnAndRow() in xxxxx

Can anyone help ??I tried to search the issues with the method name but no luck there.

@oleibman
Copy link
Collaborator

oleibman commented Mar 2, 2024

It was deprecated long ago, and removed with PhpSpreadsheet 2.0.0. You can replace:

setCellValueByColumnAndRow($column, $row, $value);

with

setCellValue([$column, $row], $value);

@cmanley
Copy link

cmanley commented May 8, 2024

It would've been nice if the removal notice was included in the 2.0.0 release notes instead of a subtle reference to a huge commit of deprecated things: 816b91d
I ran into this to trying to update an existing project. Hopefully there aren't any other breaking changes that aren't in the release notes.

@oleibman
Copy link
Collaborator

oleibman commented May 8, 2024

The deprecations are all listed in CHANGELOG.md when they first happen. In the case of this change, that would be the release notes for 1.23.0 from April 2022. You can search for "deprecated" in that file to make sure you aren't adversely affected by something else. I agree that this could have been made clearer in the 2.0.0 release notes; we will try to bear this in mind for future releases.

@cmanley
Copy link

cmanley commented May 8, 2024

Thanks. I found another deprecation (FORMAT_DATE_YYYYMMDD2) in a later 1.* release too,
In case anybody runs into the same issues as me, here are the sed commands I used to save time:

grep -rF -l --exclude-dir=.git --include=*.php -- ByColumnAndRow | grep -vF vendor | xargs sed -i -r 's/(setCellValue)(Explicit)?ByColumnAndRow\(([^,]+,[^,]+)(,)/\1\2([\3]\4/g'
grep -rF -l --exclude-dir=.git --include=*.php -- ByColumnAndRow | grep -vF vendor | xargs sed -i -E 's/(getCell)ByColumnAndRow\(([^,]+,[^,)]+)/\1([\2]/g'
grep -rF -l --exclude-dir=.git --include=*.php -- ByColumnAndRow | grep -vF vendor | xargs sed -i -E 's/(getStyle)ByColumnAndRow\(([^)]+)/\1([\2]/g'
grep -rF -l --exclude-dir=.git --include=*.php -- ByColumnAndRow | grep -vF vendor | xargs sed -i -E 's/(mergeCells)ByColumnAndRow\(([^)]+)/\1([\2]/g'
grep -rF -l --exclude-dir=.git --include=*.php -- FORMAT_DATE_YYYYMMDD2 | grep -vF vendor | xargs replace FORMAT_DATE_YYYYMMDD2 FORMAT_DATE_YYYYMMDD --

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants