понедельник, 20 августа 2018 г.

Fedora - how to increase browser scroll speed

To increase mouse wheel speed, just install rpm binary package from https://fedora.pkgs.org/28/russian-fedora-free-i386/imwheel-1.0.0-0.1.pre12.fc28.i686.rpm.html . After installing, you will feel that scroll speed increased. Do not forget add it to autostart

четверг, 2 августа 2018 г.

Symfony how to bind request data to form without HTML

When you want to bind data to form (for example in your REST application) as in FOSRestBundle, but after handleRequest() you doesn't have submitted data, try to map it with

$this->get('form.factory')->createNamed('', MyFormType::class, $dummy, ['csrf_protection' => false]);

, where first parameter is empty string, the second is form, $dummy is for model or entity object. So you can use form validation in simple Symfony action.

понедельник, 30 июля 2018 г.

FOSRestBundle invalid form doesn't use ExceptionWrapper

If your FOSRestBundle response doesn't have normal type, (for example, as below):

{
    "form": {
        "children": {
            "currency": {},
            "limit": {
                "errors": [
                    "This value should be greater than or equal to 0."                ]
            },
            "": {},
            "name": {}
        }
    },
    "errors": []
},
As we see, there are no 'code' and 'message' keys, so FOSRestBundle type is wrong. To fix it, use
$view->getContext()->setAttribute('status_code', Response::HTTP_BAD_REQUEST);
for your $view object.

среда, 4 июля 2018 г.

Notice: undefined index id after changing MongoDB id to string

after using a php annotation @Mongo\Id(strategy="NONE") you can receive Notice: undefined index id PHP error, for this just run symfony cache:clear command.

вторник, 15 мая 2018 г.

Sulu /admin/translations/sulu.en.json?v=develop error fix

Be sure you haven't deleted sulu.en.json in project web/admin, and there anything will not be deleted (for example as Vagrant's Rsync do that). After this restore translations with php bin/console sulu:translate:export .

понедельник, 7 мая 2018 г.

Symfony FileType doesnt append file

If you cannot receive file on form submit (file field left null), be sure your {{ form_row(file) }} is inside {{ form-start(form) }} and {{ form_end(form) }}, and also check is this scope closed properly, check this in Devtools.

суббота, 5 мая 2018 г.

How to fix Sulu page previews

thanks to this commit, you can update Sulu from 1.6.17 to 1.6.18 and receive this fix.