Fix b8 migration regressions, v2.3.5 milestone bugs, and convert to the property API - #533
Open
sultann wants to merge 10 commits into
Open
Fix b8 migration regressions, v2.3.5 milestone bugs, and convert to the property API#533sultann wants to merge 10 commits into
sultann wants to merge 10 commits into
Conversation
… model into Deprecated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the bytekit -> b8 model migration on
release/2.3.5. Fixes regressions the migration introduced, closes the three v2.3.5 milestone bugs, and converts the free plugin's own code off the deprecated getter/setter shims onto the new property API. The deprecated shims themselves are intentionally kept — master Pro (1.4.6) and the Legacy API add-on still call them.All changes verified against the PHPUnit suite (89 tests green) and phpcs (clean).
Migration regressions
customer_id->order_id IN (...)translation. Restored as aquery_argsfilter on the Key model (honors the framework's empty-IN-is-ignored contract). +2 tests.enable_productnever fired — the hook waswc_serial_numbers_key_insert, but b8 fireswc_serial_numbers_key_insertedand passes the model (not an id). Rewired and signature fixed. Removed three dead encrypt/decrypt action hooks the model now owns directly. +1 test.wcsn_order_replace_keycounted failed saves as success —save()returns a truthyWP_Erroron failure; now checks! is_wp_error().v2.3.5 milestone bugs
Key::find()returnsnullfor a missing id, so! $key->exists()fataled. Null-guarded the edit screen lookup. +1 test.activationsfield returned model objects (which JSON-encode to{}); b8 ignores the oldARRAY_Aoutput arg. Now mapped throughto_array()to restore the documented array contract. +1 test (incl. JSON round-trip).product_id => 0for "All Products", which b8 turns intoWHERE product_id = 0(no rows). Fixed free-side (Key::prepare_product_querydrops a zeroproduct_id) so unmodified master Pro works. +1 test.Deprecated API -> property API conversion
Converted ~90 internal call sites across 11 files (REST, admin screens/list tables, templates, PDF integrations, core helpers) from
$key->get_*()/$key->set_*()to property access ($key->serial_key,$key->status = ..., etc.). No behavior change; the deprecated methods remain for external consumers.Pro compatibility
Master Pro 1.4.6's full call surface into the free plugin (wcsn_* functions, Key/Activation getters,
where_query, the generator/duplicate filters, the REST activations contract) is satisfied. The only break was #532, now fixed free-side.Closes #527, #531, #532.