суббота, 30 марта 2019 г.

symfony4 MAILER_URL Mailgun smtp example

Your .env.local:

MAILER_URL=smtp://smtp.mailgun.org?encryption=tls&auth_mode=login&username=yourusername&password=yourpassword

четверг, 28 марта 2019 г.

composer vcs repository doesn't update package latest commit

Manually find package in composer.lock and replace old commit occurencies to new commit hash.

sylius grid 'sorting' doesnt work fix

make your needed field for sorting `sortable: true` in `fields:` definition, for example:

sylius_grid:
    grids:
        my_grid:
            driver:
                name: doctrine/orm
                options:
                    class: App\Document\Record
            sorting:
                datetime: desc
            fields:
                datetime:
                    type: datetime
                    sortable: true

воскресенье, 24 марта 2019 г.

Entity of type * passed to the choice field must be managed - solution fix

If available, try to use ChoiceType instead of EntityType form type.

вторник, 19 марта 2019 г.

[Symfony4 upgrade] bundle app does not exist or it is not enabled

Remove these lines in your config/routes.yaml:
app:
    resource: '@App/Controller/'
    type: annotation

понедельник, 18 марта 2019 г.

[Symfony standalone] There is no extension able to load the configuration for

If you are using symfony/dependency-injection as standalone and you have this error in using YAML file loader, add `services:` node at the top of your services.yaml file.

среда, 13 марта 2019 г.

[MongoDB] [Symfony] "Could not find the document manager for class" fix with autowiring

For repository use this class below. Notice that it uses ManagerRegistry instead of Symfony\Bridge\Doctrine\RegistryInterface
<?php

use AppBundle\Document\Product;
use Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepository;
use Doctrine\Bundle\MongoDBBundle\ManagerRegistry;

class ProductRepository extends ServiceDocumentRepository
{
    public function __construct(ManagerRegistry $managerRegistry)
    {
        parent::__construct($managerRegistry, Product::class);
    }
}