Skip to content

Fix for #15: Fixed bug for editSong throwing error when song_id doesn't exist#42

Merged
panique merged 3 commits intopanique:masterfrom
mhco:patch-2
Mar 29, 2018
Merged

Fix for #15: Fixed bug for editSong throwing error when song_id doesn't exist#42
panique merged 3 commits intopanique:masterfrom
mhco:patch-2

Conversation

@mhco
Copy link
Copy Markdown

@mhco mhco commented Mar 29, 2018

For #15:

If a song doesn't exist in the database, the application will throw a PHP error. To fix this, I check for rowCount() of the getSong method, and, if it's zero (i.e. that song_id doesn't exist in the database), I return false. I then check the status of that in the SongsController editSong method, and display either the edit page, or the error page depending.

This can be changed by the user in a variety of ways.

Understanding this page probably doesn't matter much to users of this framework, a bug is a bug.

@panique this is a rudimentary solution, and certainly not a hyper elegant one. If there's a better solution for it, please feel free to change it. This uses the error solution from PR #41, to display the error page in-place, instead of redirecting to the error page; this can be changed easily, however.

@panique panique merged commit ca142af into panique:master Mar 29, 2018
@panique
Copy link
Copy Markdown
Owner

panique commented Mar 29, 2018

Thank you very much :)
Good stuff!

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