Editor Field to MySql Function

Editor Field to MySql Function

jtoler5jtoler5 Posts: 93Questions: 34Answers: 3

I have a custom Mysql stored function that works just fine by doing

                Field::inst(sprintf('f_charge_has_tags(%s)', 'charges.id'), 'charges.has_tags'),

But I want to know how I can possible alter the 'charges.id' being sent?

Answers

  • jtoler5jtoler5 Posts: 93Questions: 34Answers: 3
    edited October 14

    Say I wanted to do

    $this->decrypt('charges.id')
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    At the moment you'd need to construct your own query to use SQL functions for value setting (which I think is what you are doing?) - sorry. This is a limitation in the server-side libraries that I'm aware of and do plan to address in future.

    Allan

  • jtoler5jtoler5 Posts: 93Questions: 34Answers: 3

    Yeah, I realized after posting... this was a dumb question for me to ask. I wish i could delete this post. :)

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I think it is a perfectly good question - as I mentioned it is a limitation in the library, and the fact that you asked it lets me know that you want it! I sometimes get questions such as "I can't believe this doesn't do X!" - and often that's because no one has ever asked for it. So it is important for me to know what is needed and I can prioritise including that as a data point :).

    That said, if you want this post gone, I can delete it!

    Allan

  • jtoler5jtoler5 Posts: 93Questions: 34Answers: 3

    No, you can leave it. :) I will just add, for whatever it may be worth! If you ever find to time or someone else builds it.... obviously Editor support for Symfony would be freakin amazing! I feel like I came across a 3rd party one couple years back - started with a "Y", maybe? But, I think that was before Editor 2.0 and it just didn't truly seem like it provided true Symfony support. I could be wrong, it has been years.

    My original question was a slight issue I had modifying and add the data sent to page and include a encrypted version of table id - encrypted using Symfony's easy encrypt/decrypt feature. I essentially end up doing something like:

    Field::inst('charges.id')->set(false),
    Field::inst('charges.id')
        ->name('charges.encrypted_id')
        ->getFormatter(function (string $val): string {
        return $this->encrypt($val);
    })
    

    Then decrypting in some Editor methods - and it works. But when something broke I was quick to blame Editor and it turn out be just me forgetting to decrypt somewhere. So, I'm saying.... if you ever find the free time (ha!) and feeling adventurous... think it would be freaking awesome to have true package for Symfony!! :)

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    Thanks for the feedback. At the moment my intention with each of the platforms Editor supports on the server-side is to target the language, not a framework on top of that language. Editor's PHP libraries work alongside Symfony, Laravel, Cake and countless others, but if I supported just specific frameworks I'd either need a large number of packages (and massively increase the development and support burden), or reduce my potential marketshare to just one framework. The same applies with the .NET, Node.js and upcoming Python libraries.

    It would be nice to have tighter integration with frameworks such as Symfony, but it just isn't within my power to do that at the moment. Perhaps if I were some multi-million dollar business with a team of devs and support it would be possible, but not just me.

    Great to hear that you were able to get a pure PHP solution to the issue in the end :).

    Allan

Sign In or Register to comment.