Commit ac4b4889 authored by romanb's avatar romanb

[2.0][DDC-57] Fixed.

parent 4918d3e1
...@@ -163,7 +163,7 @@ class ManyToManyMapping extends AssociationMapping ...@@ -163,7 +163,7 @@ class ManyToManyMapping extends AssociationMapping
if ($this->isOwningSide) { if ($this->isOwningSide) {
foreach ($this->sourceToRelationKeyColumns as $sourceKeyColumn => $relationKeyColumn) { foreach ($this->sourceToRelationKeyColumns as $sourceKeyColumn => $relationKeyColumn) {
// getting id // getting id
if (isset($sourceClass->reflFields[$sourceKeyColumn])) { if (isset($sourceClass->fieldNames[$sourceKeyColumn])) {
$joinTableConditions[$relationKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity); $joinTableConditions[$relationKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
} else { } else {
$joinTableConditions[$relationKeyColumn] = $joinColumnValues[$sourceKeyColumn]; $joinTableConditions[$relationKeyColumn] = $joinColumnValues[$sourceKeyColumn];
...@@ -174,7 +174,7 @@ class ManyToManyMapping extends AssociationMapping ...@@ -174,7 +174,7 @@ class ManyToManyMapping extends AssociationMapping
// TRICKY: since the association is inverted source and target are flipped // TRICKY: since the association is inverted source and target are flipped
foreach ($owningAssoc->targetToRelationKeyColumns as $sourceKeyColumn => $relationKeyColumn) { foreach ($owningAssoc->targetToRelationKeyColumns as $sourceKeyColumn => $relationKeyColumn) {
// getting id // getting id
if (isset($sourceClass->reflFields[$sourceKeyColumn])) { if (isset($sourceClass->fieldNames[$sourceKeyColumn])) {
$joinTableConditions[$relationKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity); $joinTableConditions[$relationKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
} else { } else {
$joinTableConditions[$relationKeyColumn] = $joinColumnValues[$sourceKeyColumn]; $joinTableConditions[$relationKeyColumn] = $joinColumnValues[$sourceKeyColumn];
......
...@@ -576,9 +576,11 @@ class StandardEntityPersister ...@@ -576,9 +576,11 @@ class StandardEntityPersister
protected function _getSelectManyToManyEntityCollectionSql($manyToMany, array &$criteria) protected function _getSelectManyToManyEntityCollectionSql($manyToMany, array &$criteria)
{ {
$columnList = ''; $columnList = '';
$tableName = $this->_class->getQuotedTableName($this->_platform);
foreach ($this->_class->fieldNames as $field) { foreach ($this->_class->fieldNames as $field) {
if ($columnList != '') $columnList .= ', '; if ($columnList != '') $columnList .= ', ';
$columnList .= $this->_class->getQuotedColumnName($field, $this->_platform); $columnList .= $tableName . '.' . $this->_class->getQuotedColumnName($field, $this->_platform);
} }
foreach ($this->_class->associationMappings as $assoc) { foreach ($this->_class->associationMappings as $assoc) {
......
...@@ -15,8 +15,7 @@ use Doctrine\Common\Collections\ArrayCollection; ...@@ -15,8 +15,7 @@ use Doctrine\Common\Collections\ArrayCollection;
class ECommerceCategory class ECommerceCategory
{ {
/** /**
* @Column(type="integer") * @Id @Column(type="integer")
* @Id
* @GeneratedValue(strategy="AUTO") * @GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
......
...@@ -40,8 +40,8 @@ class ECommerceProduct ...@@ -40,8 +40,8 @@ class ECommerceProduct
/** /**
* @ManyToMany(targetEntity="ECommerceCategory", cascade={"persist"}) * @ManyToMany(targetEntity="ECommerceCategory", cascade={"persist"})
* @JoinTable(name="ecommerce_products_categories", * @JoinTable(name="ecommerce_products_categories",
joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")}, * joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")},
inverseJoinColumns={@JoinColumn(name="category_id", referencedColumnName="id")}) * inverseJoinColumns={@JoinColumn(name="category_id", referencedColumnName="id")})
*/ */
private $categories; private $categories;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment