I am requesting the inclusion of enhanced methods to query JSON column types directly via cycle/orm. This feature not only aligns with the capabilities offered by frameworks like Laravel, but also significantly improves the overall Developer Experience (DX).
Current Behavior:
Currently, querying JSON in cycle/orm involves more complex, less intuitive code:
...
use Cycle\Database\Injection\Parameter;
...
$exists = $webhookCallsRepository
->select()
->where(['name' => 'stripe'])
->andWhere("JSON_EXTRACT(payload, '$.id')", '=', new Parameter(['payloadId' => $request->get('id')]))
->count();
Improved Developer Experience (DX): This change would significantly reduce the complexity and verbosity of JSON-related queries, leading to faster and more intuitive coding.
Reduced Errors: Leveraging built-in methods reduces the likelihood of errors from manually written SQL statements.
Alignment with Popular Frameworks: It brings cycle/orm on par with other frameworks, making it a more attractive option for developers familiar with those patterns.
I believe this feature, coupled with other necessary changes, would be a valuable addition to cycle/orm. I look forward to feedback and potential inclusion in a future release.
I have an idea!
Feature Request:
I am requesting the inclusion of enhanced methods to query JSON column types directly via cycle/orm. This feature not only aligns with the capabilities offered by frameworks like Laravel, but also significantly improves the overall Developer Experience (DX).
Current Behavior:
Currently, querying JSON in cycle/orm involves more complex, less intuitive code:
Full class located here: https://github.com/wayofdev/laravel-stripe-webhooks/blob/master/src/Profile/StripeWebhookProfile.php
Desired Behavior:
Proposal:
I've checked internal code of cycle/orm and found that first thing to modify would be WhereTrait.php, where additional methods could be implemented:
Benefits:
Improved Developer Experience (DX): This change would significantly reduce the complexity and verbosity of JSON-related queries, leading to faster and more intuitive coding.
Reduced Errors: Leveraging built-in methods reduces the likelihood of errors from manually written SQL statements.
Alignment with Popular Frameworks: It brings cycle/orm on par with other frameworks, making it a more attractive option for developers familiar with those patterns. I believe this feature, coupled with other necessary changes, would be a valuable addition to cycle/orm. I look forward to feedback and potential inclusion in a future release.