1000 search results

54 lines | src/Repository/QuestionRepository.php
// ... lines 1 - 6
use Doctrine\ORM\QueryBuilder;
// ... lines 8 - 15
class QuestionRepository extends ServiceEntityRepository
{
// ... lines 18 - 36
private function addIsAskedQueryBuilder(QueryBuilder $qb): QueryBuilder
{
// ... line 39
}
// ... lines 41 - 52
}
See Code Block in Script
93 lines | src/Controller/QuestionController.php
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
// ... lines 8 - 12
class QuestionController extends AbstractController
{
// ... lines 15 - 35
public function new(EntityManagerInterface $entityManager)
{
// ... lines 38 - 65
}
// ... lines 67 - 91
}
See Code Block in Script
93 lines | src/Controller/QuestionController.php
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
// ... lines 8 - 12
class QuestionController extends AbstractController
{
// ... lines 15 - 35
public function new(EntityManagerInterface $entityManager)
{
// ... lines 38 - 57
$entityManager->persist($question);
$entityManager->flush();
// ... lines 60 - 65
}
// ... lines 67 - 91
}
See Code Block in Script
93 lines | src/Controller/QuestionController.php
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
// ... lines 8 - 12
class QuestionController extends AbstractController
{
// ... lines 15 - 35
public function new(EntityManagerInterface $entityManager)
{
// ... lines 38 - 57
$entityManager->persist($question);
$entityManager->flush();
return new Response(sprintf(
'Well hallo! The shiny new question is id #%d, slug: %s',
$question->getId(),
$question->getSlug()
));
}
// ... lines 67 - 91
}
See Code Block in Script
30 lines | .env
// ... lines 1 - 22
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
###< doctrine/doctrine-bundle ###
See Code Block in Script
87 lines | src/Repository/UserRepository.php
// ... lines 1 - 6
use Doctrine\Persistence\ManagerRegistry;
// ... lines 8 - 14
class UserRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
// ... line 19
}
// ... lines 21 - 85
}
See Code Block in Script
51 lines | src/Repository/TagRepository.php
// ... lines 1 - 6
use Doctrine\Persistence\ManagerRegistry;
// ... lines 8 - 14
class TagRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
// ... line 19
}
// ... lines 21 - 49
}
See Code Block in Script
82 lines | src/Repository/CommentRepository.php
// ... lines 1 - 8
use Doctrine\Persistence\ManagerRegistry;
// ... lines 10 - 17
class CommentRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
// ... line 22
}
// ... lines 24 - 80
}
See Code Block in Script
75 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 8
use Doctrine\Persistence\ManagerRegistry;
// ... lines 10 - 16
class ArticleRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
// ... line 21
}
// ... lines 23 - 73
}
See Code Block in Script
51 lines | src/Repository/ApiTokenRepository.php
// ... lines 1 - 6
use Doctrine\Persistence\ManagerRegistry;
// ... lines 8 - 14
class ApiTokenRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
// ... line 19
}
// ... lines 21 - 49
}
See Code Block in Script
62 lines | .env
// ... lines 1 - 22
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://root:@127.0.0.1:3306/the_spacebar
###< doctrine/doctrine-bundle ###
// ... lines 30 - 62
See Code Block in Script
105 lines | composer.json
{
// ... lines 2 - 3
"require": {
// ... lines 5 - 8
"doctrine/doctrine-bundle": "^1.6.10|^2.0",
"doctrine/doctrine-migrations-bundle": "^1.3|^2.0",
"doctrine/orm": "^2.5.11",
// ... lines 12 - 44
},
// ... lines 46 - 103
}
See Code Block in Script
105 lines | composer.json
{
// ... lines 2 - 3
"require": {
// ... lines 5 - 8
"doctrine/doctrine-bundle": "^2.0",
// ... lines 10 - 44
},
// ... lines 46 - 103
}
See Code Block in Script
35 lines | src/DataPersister/UserDataPersister.php
// ... lines 1 - 6
use Doctrine\ORM\EntityManagerInterface;
// ... line 8
class UserDataPersister implements DataPersisterInterface
{
private $entityManager;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
}
// ... lines 17 - 33
}
See Code Block in Script
67 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Criteria;
// ... lines 8 - 16
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 19 - 35
public static function createNonDeletedCriteria(): Criteria
{
// ... lines 38 - 41
}
// ... lines 43 - 65
}
See Code Block in Script
67 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Criteria;
// ... lines 8 - 16
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 19 - 35
public static function createNonDeletedCriteria(): Criteria
{
return Criteria::create()
->andWhere(Criteria::expr()->eq('isDeleted', false))
->orderBy(['createdAt' => 'DESC'])
;
}
// ... lines 43 - 65
}
See Code Block in Script
Which doctrine annotation should I use if I really wanted to assign a $genusScientist to another $genus instead of completely removing it from the database? Thanks.
Using Doctrine's automatic database creation/update via annotations seems like an amazing feature Are migrations used a lot in the Symfony world? Because at this point you might aswell use Laravel :p
Does Doctrine do any caching of ArrayCollections by default? I'm having some issues after doing my clone process above. After doing the clone above, I return the "id" of the $NewGenus. When I later call the Entity Manager to retrieve that new Genus by…
Terry Caliendo
Terry Caliendo
Read Full Comment
80 lines | src/DataFixtures/ArticleFixtures.php
// ... lines 1 - 7
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
// ... lines 9 - 10
class ArticleFixtures extends BaseFixture implements DependentFixtureInterface
{
// ... lines 13 - 78
}
See Code Block in Script