Doctrine follows a six monthly release schedule and adds a considerable amount of new features in new release. This talk discusses some of the more recent features and how they help you build applications with Symfony2.
$user->getGroup(); 4 5 // do something with $user and $group 6 7 // single flush 8 $entityManager->flush($user); 9 10 // set flush 11 $entityManager->flush(array($user, $group));
4 p AS post, 5 COUNT(p.comments) AS comment_count 6 FROM 7 Post p 8 DQL; 9 10 $results = $entityManager->createQuery($dql)->getResult(); 11 12 foreach ($results as $row) { 13 $post = $row['post']; 14 $count = $row['comment_count']; 15 }
use Doctrine\ORM\Id\AbstractIdGenerator; 5 6 class SnowflakeIdGenerator extends AbstractIdGenerator 7 { 8 public function generate(EntityManager $em, $entity) 9 { 10 return snowflake_get_id(); // made up API 11 } 12 }
5 public function __construct($city, $street) 6 { 7 } 8 } 9 10 $dql = <<<DQL 11 SELECT new AddressDTO(a.city, a.street) 12 FROM User u JOIN u.address a WHERE u.id = ?1 13 DQL;