Skip to content

Commit

Permalink
Add type hints for repository templates
Browse files Browse the repository at this point in the history
  • Loading branch information
enleur committed Feb 7, 2018
1 parent a481d54 commit e7dfff0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/Resources/skeleton/doctrine/Repository.tpl.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<?= "<?php\n" ?>
<?= "<?php\n"; ?>

namespace App\Repository;

use App\Entity\<?= $entity_class_name ?>;
use App\Entity\<?= $entity_class_name; ?>;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;

class <?= $repository_class_name ?> extends ServiceEntityRepository
/**
* @method <?= $entity_class_name; ?>|null find($id, $lockMode = null, $lockVersion = null)
* @method <?= $entity_class_name; ?>|null findOneBy(array $criteria, array $orderBy = null)
* @method <?= $entity_class_name; ?>[] findAll()
* @method <?= $entity_class_name; ?>[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class <?= $repository_class_name; ?> extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, <?= $entity_class_name ?>::class);
parent::__construct($registry, <?= $entity_class_name; ?>::class);
}

/*
public function findBySomething($value)
{
return $this->createQueryBuilder('<?= $entity_alias ?>')
->where('<?= $entity_alias ?>.something = :value')->setParameter('value', $value)
->orderBy('<?= $entity_alias ?>.id', 'ASC')
return $this->createQueryBuilder('<?= $entity_alias; ?>')
->where('<?= $entity_alias; ?>.something = :value')->setParameter('value', $value)
->orderBy('<?= $entity_alias; ?>.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
Expand Down

0 comments on commit e7dfff0

Please sign in to comment.