PHP code example of bulton-fr / doctrine_yield

1. Go to this page and download the library: Download bulton-fr/doctrine_yield library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bulton-fr / doctrine_yield example snippets




namespace MyBundle\Repository;

use Doctrine\ORM\EntityRepository;
use BultonFr\DoctrineYield\RepositoryYieldTrait;

class MyEntityRepository extends EntityRepository
{
    use RepositoryYieldTrait;
}



namespace MyBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class ExampleController extends Controller
{
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Generator $allData */
        $allData = $em
            ->getRepository('MyBundle:MyEntity')
            ->yieldAll()
        ;

        //[...]
    }
}