1000 search results

Hey Dmitriy, But Doctrine already does this for you. You just need to generate an entity via MakerBundle, or make sure your User entity has this mapping config: ```php User { #[ORM\Id, ORM\Column, ORM\GeneratedValue] private ?int $id = null; } ``` Every time you will…
168 lines | src/Entity/DragonTreasure.php
// ... lines 1 - 5
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
// ... lines 7 - 39
class DragonTreasure
{
// ... lines 42 - 48
#[ApiFilter(SearchFilter::class, strategy: 'partial')]
private ?string $name = null;
// ... lines 51 - 166
}
See Code Block in Script
169 lines | src/Entity/DragonTreasure.php
// ... lines 1 - 5
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
// ... lines 7 - 39
class DragonTreasure
{
// ... lines 42 - 48
#[ApiFilter(SearchFilter::class, strategy: 'partial')]
private ?string $name = null;
// ... lines 51 - 53
#[ApiFilter(SearchFilter::class, strategy: 'partial')]
private ?string $description = null;
// ... lines 56 - 167
}
See Code Block in Script
171 lines | src/Entity/DragonTreasure.php
// ... lines 1 - 6
use ApiPlatform\Doctrine\Orm\Filter\RangeFilter;
// ... lines 8 - 40
class DragonTreasure
{
// ... lines 43 - 62
#[ApiFilter(RangeFilter::class)]
private ?int $value = null;
// ... lines 65 - 169
}
See Code Block in Script
…use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data! # - ./docker/db/data:/var/lib/postgresql/data:rw ###< doctrine/doctrine-bundle ### volumes: ###> doctrine/doctrine-bundle ### db-data: ###< doctrine/doctrine-bundle ### ```
22 lines | config/packages/netgen_layouts.yaml
netgen_layouts:
// ... lines 2 - 3
value_types:
doctrine_recipe:
// ... lines 6 - 22
See Code Block in Script
With `symfony console doctrine:fixtures:load --append` it will append data.
57 lines | src/Controller/VinylController.php
// ... lines 1 - 5
use Pagerfanta\Doctrine\ORM\QueryAdapter;
use Pagerfanta\Pagerfanta;
// ... lines 8 - 12
class VinylController extends AbstractController
{
// ... lines 15 - 38
public function browse(VinylMixRepository $mixRepository, string $slug = null): Response
{
// ... lines 41 - 43
$adapter = new QueryAdapter($queryBuilder);
$pagerfanta = Pagerfanta::createForCurrentPageWithMaxPerPage(
$adapter,
1,
9
);
// ... lines 50 - 54
}
}
See Code Block in Script
22 lines | docker-compose.yml
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-13}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}
POSTGRES_USER: ${POSTGRES_USER:-symfony}
volumes:
- db-data:/var/lib/postgresql/data:rw
// ... lines 14 - 22
See Code Block in Script
9 lines | docker-compose.override.yml
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
// ... lines 8 - 9
See Code Block in Script
Hey davidmintz The `doctrine/cache` library was deprecated some time ago. I'm not sure how you ran into this problem but I'm guessing you upgraded the DoctrineBundle library. Try upgrading all doctrine libraries by running ``` composer upgrade "doctrine/*" ``` and clear the cache manually…
MolloKhan
MolloKhan
Read Full Comment
Hello Vladimir, installing latest doctrine-migrations-bundle (3.2.2) solved the issue (see also GitHub). But strange that only the messenger consumption per CLI caused an issue. The rest of the website worked perfect with the previous version. Anyway ... many thanks for supporting me…
Hey Mepcuk Doctrine does not impose you any style. If you want your entities to behave as anemic or rich domain model it's up to you and the needs of your application. Cheers!
MolloKhan
MolloKhan
Read Full Comment
87 lines | src/Controller/QuestionController.php
// ... lines 1 - 9
use Pagerfanta\Doctrine\ORM\QueryAdapter;
use Pagerfanta\Pagerfanta;
// ... lines 12 - 17
class QuestionController extends AbstractController
{
// ... lines 20 - 32
public function homepage(QuestionRepository $repository)
{
$queryBuilder = $repository->createAskedOrderedByNewestQueryBuilder();
$pagerfanta = new Pagerfanta(new QueryAdapter($queryBuilder));
$pagerfanta->setMaxPerPage(5);
// ... lines 39 - 42
}
// ... lines 44 - 85
}
See Code Block in Script
…so apparently doctrine cache has been deprecated. https://github.com/doctrine/cache/issues/354, So tried installing an older cache library to make it work. You will need to install this version of Doctrine cache using this in your terminal. ` composer require doctrine/cache:1…
shirleenkneppers
shirleenkneppers
Read Full Comment
I solved everything with doctrine extensions now. Don't know the best practise? Provider or extension? But for me it works great now.
Hey @Antsen There are Doctrine extensions that allows you to create translatable entities also some bundles which helps organising it. Unfortunately can't advice any guidance or best practice yet. Cheers
…stof/doctrine-extensions-bundle --with-all-dependencies Loading composer repositories with package information Restricting packages listed in "symfony/symfony" to "5.1.*" Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires stof/doctrine-extensions…
Jörg daniel F.
Jörg daniel F.
Read Full Comment
If you get "[Doctrine\DBAL\Exception\DriverException] An exception occurred in driver: could not find driver", simply uncomment extension=pdo_sqlite in php.ini in your php installation folder (by deleting ";").
Angelika R.
Angelika R.
Read Full Comment
PhpStrom doesn't generating doctrine repository. How to fix this?