@@ -142,8 +142,12 @@ class AnnotationDriver implements Driver
|
||||
|
||||
$classAnnotations = $this->_reader->getClassAnnotations($class);
|
||||
|
||||
if ($classAnnotations && is_numeric(key($classAnnotations))) {
|
||||
foreach ($classAnnotations as $annot) {
|
||||
if ($classAnnotations) {
|
||||
foreach ($classAnnotations as $key => $annot) {
|
||||
if ( ! is_numeric($key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$classAnnotations[get_class($annot)] = $annot;
|
||||
}
|
||||
}
|
||||
@@ -432,8 +436,11 @@ class AnnotationDriver implements Driver
|
||||
if ($method->isPublic() && $method->getDeclaringClass()->getName() == $class->name) {
|
||||
$annotations = $this->_reader->getMethodAnnotations($method);
|
||||
|
||||
if ($annotations && is_numeric(key($annotations))) {
|
||||
foreach ($annotations as $annot) {
|
||||
if ($annotations) {
|
||||
foreach ($annotations as $key => $annot) {
|
||||
if ( ! is_numeric($key)) {
|
||||
continue;
|
||||
}
|
||||
$annotations[get_class($annot)] = $annot;
|
||||
}
|
||||
}
|
||||
|
@@ -284,7 +284,7 @@ final class PersistentCollection implements Collection
|
||||
/**
|
||||
* INTERNAL: Gets the association mapping of the collection.
|
||||
*
|
||||
* @return \Doctrine\ORM\Mapping\AssociationMapping
|
||||
* @return array
|
||||
*/
|
||||
public function getMapping()
|
||||
{
|
||||
|
@@ -178,7 +178,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
// Composite identifier
|
||||
$sourceClass = $this->_em->getClassMetadata(get_class($mapping->getOwner()));
|
||||
$sourceClass = $this->_em->getClassMetadata(get_class($coll->getOwner()));
|
||||
|
||||
foreach ($mapping['relationToSourceKeyColumns'] as $relColumn => $srcColumn) {
|
||||
$params[] = $identifier[$sourceClass->fieldNames[$srcColumn]];
|
||||
|
@@ -21,7 +21,6 @@ namespace Doctrine\ORM\Proxy;
|
||||
|
||||
use Doctrine\ORM\EntityManager,
|
||||
Doctrine\ORM\Mapping\ClassMetadata,
|
||||
Doctrine\ORM\Mapping\AssociationMapping,
|
||||
Doctrine\Common\Util\ClassUtils;
|
||||
|
||||
/**
|
||||
|
@@ -21,6 +21,7 @@ namespace Doctrine\ORM;
|
||||
|
||||
use Doctrine\DBAL\LockMode,
|
||||
Doctrine\ORM\Query\Parser,
|
||||
Doctrine\ORM\Query\ParserResult,
|
||||
Doctrine\ORM\Query\QueryException;
|
||||
|
||||
/**
|
||||
@@ -218,7 +219,7 @@ final class Query extends AbstractQuery
|
||||
$hash = $this->_getQueryCacheId();
|
||||
$cached = $this->_expireQueryCache ? false : $queryCache->fetch($hash);
|
||||
|
||||
if ($cached !== false) {
|
||||
if ($cached instanceof ParserResult) {
|
||||
// Cache hit.
|
||||
$this->_parserResult = $cached;
|
||||
|
||||
|
@@ -94,7 +94,7 @@ class QueryException extends \Doctrine\ORM\ORMException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\Mapping\AssociationMapping $assoc
|
||||
* @param array $assoc
|
||||
*/
|
||||
public static function iterateWithFetchJoinCollectionNotAllowed($assoc)
|
||||
{
|
||||
@@ -151,4 +151,4 @@ class QueryException extends \Doctrine\ORM\ORMException
|
||||
return new self("Cannot check if a child of '" . $rootClass . "' is instanceof '" . $className . "', " .
|
||||
"inheritance hierachy exists between these two classes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,8 +20,8 @@
|
||||
namespace Doctrine\ORM\Tools;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo,
|
||||
Doctrine\ORM\Mapping\AssociationMapping,
|
||||
Doctrine\Common\Util\Inflector;
|
||||
Doctrine\Common\Util\Inflector,
|
||||
Doctrine\DBAL\Types\Type;
|
||||
|
||||
/**
|
||||
* Generic class used to generate PHP5 entity classes from ClassMetadataInfo instances
|
||||
@@ -143,7 +143,7 @@ public function <methodName>(<methodTypeHint>$<variableName>)
|
||||
'/**
|
||||
* <description>
|
||||
*
|
||||
* @param <variableType$<variableName>
|
||||
* @param <variableType>$<variableName>
|
||||
*/
|
||||
public function <methodName>(<methodTypeHint>$<variableName>)
|
||||
{
|
||||
|
@@ -23,7 +23,6 @@
|
||||
namespace Doctrine\ORM\Tools\Export\Driver;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo,
|
||||
Doctrine\ORM\Mapping\AssociationMapping,
|
||||
Doctrine\ORM\Tools\EntityGenerator;
|
||||
|
||||
/**
|
||||
@@ -69,4 +68,4 @@ class AnnotationExporter extends AbstractExporter
|
||||
{
|
||||
$this->_entityGenerator = $entityGenerator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ class Version
|
||||
/**
|
||||
* Current Doctrine Version
|
||||
*/
|
||||
const VERSION = '2.2.3-DEV';
|
||||
const VERSION = '2.2.4-DEV';
|
||||
|
||||
/**
|
||||
* Compares a Doctrine version with the current one.
|
||||
|
@@ -30,12 +30,25 @@ class NavPointOfInterest
|
||||
*/
|
||||
private $country;
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="NavUser", cascade={"persist"})
|
||||
* @JoinTable(name="navigation_pois_visitors",
|
||||
* inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
|
||||
* joinColumns={
|
||||
* @JoinColumn(name="poi_long", referencedColumnName="nav_long"),
|
||||
* @JoinColumn(name="poi_lat", referencedColumnName="nav_lat")
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
private $visitors;
|
||||
|
||||
public function __construct($lat, $long, $name, $country)
|
||||
{
|
||||
$this->lat = $lat;
|
||||
$this->long = $long;
|
||||
$this->name = $name;
|
||||
$this->country = $country;
|
||||
$this->visitors = new \Doctrine\Common\Collections\ArrayCollection;
|
||||
}
|
||||
|
||||
public function getLong() {
|
||||
@@ -53,4 +66,14 @@ class NavPointOfInterest
|
||||
public function getCountry() {
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
public function addVisitor(NavUser $user)
|
||||
{
|
||||
$this->visitors[] = $user;
|
||||
}
|
||||
|
||||
public function getVisitors()
|
||||
{
|
||||
return $this->visitors;
|
||||
}
|
||||
}
|
||||
|
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavUser.php
vendored
Normal file
28
vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavUser.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Models\Navigation;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="navigation_users")
|
||||
*/
|
||||
class NavUser
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @Column(type="integer")
|
||||
* @generatedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @column(type="string")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ use Doctrine\Tests\Models\Navigation\NavCountry;
|
||||
use Doctrine\Tests\Models\Navigation\NavPointOfInterest;
|
||||
use Doctrine\Tests\Models\Navigation\NavTour;
|
||||
use Doctrine\Tests\Models\Navigation\NavPhotos;
|
||||
use Doctrine\Tests\Models\Navigation\NavUser;
|
||||
|
||||
require_once __DIR__ . '/../../TestInit.php';
|
||||
|
||||
@@ -118,4 +119,26 @@ class CompositePrimaryKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->setExpectedException('Doctrine\ORM\ORMException', 'The identifier long is missing for a query of Doctrine\Tests\Models\Navigation\NavPointOfInterest');
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('key1' => 100));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1939
|
||||
*/
|
||||
public function testDeleteCompositePersistentCollection()
|
||||
{
|
||||
$this->putGermanysBrandenburderTor();
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('lat' => 100, 'long' => 200));
|
||||
$poi->addVisitor(new NavUser("test1"));
|
||||
$poi->addVisitor(new NavUser("test2"));
|
||||
|
||||
$this->_em->flush();
|
||||
|
||||
$poi->getVisitors()->clear();
|
||||
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('lat' => 100, 'long' => 200));
|
||||
$this->assertEquals(0, count($poi->getVisitors()));
|
||||
}
|
||||
}
|
||||
|
@@ -88,6 +88,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
|
||||
'Doctrine\Tests\Models\Routing\RoutingRouteBooking',
|
||||
),
|
||||
'navigation' => array(
|
||||
'Doctrine\Tests\Models\Navigation\NavUser',
|
||||
'Doctrine\Tests\Models\Navigation\NavCountry',
|
||||
'Doctrine\Tests\Models\Navigation\NavPhotos',
|
||||
'Doctrine\Tests\Models\Navigation\NavTour',
|
||||
|
Reference in New Issue
Block a user