I have an object which contains 3 arrays, any of which may be empty, it is feasible all three can be empty, so I need to handle that requirement too. Here’s an example of the object: I need to merge these 3 arrays into a single array with unique values, using the existing keys so that the output contain…
Tag: php
Filepond: how to configure filepond to have more than 1 filepond field in the same form?
I want to have 2 different file upload field in a form and use filepond to manage image upload nicely. I could use filepond without problems with one single field in a form so far, using the code provided by the documentation. I assumed I could put more than one field with the following changes: renaming the …
Quickest way to get Expression Engine v 2.5.5 working with PHP7
A client’s host has recently updated their server to run PHP 7, which has broken their EE 2.5.5. site (“Call to undefined function mysql_connect()”). I tried upgrading EE to version 2.11.9 but get errors: Frontend: can’t find safecracker_lib Control Panel: PATH_MOD not defined in mod_structure.php, fixing thi…
How to save formdata in a Database in Symfony when using no Formbuilder?
I’m developing a Symfony Bundle for Polls. I tried to build my Poll with the Symfony Form builder but i had so many Problems due to my complex data, that i decided to build my Form manually in the html File. Is there now any possibility to still do something like that: if($form->isSubmitted() &&a…
Decrypt Crypto-js encrypted text with key with PHP
I’m using Crypto-js for encrypting password with a key and send it to server. I want to decrypt it in server using PHP. How this can be done? JS: Encrypted text: U2FsdGVkX1+EaW3J1GE1k/EU5h6C+nxBH364Xhez+b0= PHP: Result: string(32) “����>���s��ȡ�V?E��M���I” I’m getting weird results …
Symfony inject array through services.yaml
I am trying to inject an array to Event Subscriber, but I also inject an other repository so I don’t know how this will work: Here’s what I am trying: services.yaml TerminateSubscriber.php: It says that the first parameter should be an instance of the Repo, array given. But if I switch the paramet…
Hiding element (row) in woocommerce account page
I want to hide one row in the table on account page in woocommerce. This item is called ‘end’ or ‘end date’ in the table class = shop_table subscription_details. https://github.com/wp-premium/woocommerce-subscriptions/blob/master/templates/myaccount/subscription-details.php How can I d…
PHP: Class constants in type declarations of input paramaters
For a custom logger I want to force the caller to pass a valid class constant defined in PsrLogLogLevel. This class is defined like: The loggers’ function (wrong) looks like: This does not work because LogLevel::DEBUG for instance is a string and not an instance of the class. Is there any way to enforce…
Validating data in a stored JSON file in the DB using YII framework
I am trying to write a rule in my Yii project to add an exempt rule when we have a data point collected on a stored JSON. The following is my sample Yii script for the validation rule In my database, I have a column where I store extra variables as a stored JSON as shown in the diagram below,
What is the best way to do the job of Group By in mysql when sql_mode=only_full_group_by
I want to perform a query like to get the last record of any type in DB, at my localhost, I use Maria Db and the query is as follow: group is a column which I save type in it, for instance: marketing, blog, order, etc This query works fine on local, but on the server I get the following