Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.1
-
Fix Version/s: None
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
We have association on non primary key. Something like this:
Entities\Payment:
type: entity
table: payments
fields:
id:
id: true
type: integer
nullable: false
generator:
strategy: IDENTITY
[-- skipped --]
manyToOne:
order:
targetEntity: Entities\Order
inversedBy: payments
joinColumn:
name: scode
referencedColumnName: scode
Entities\Order:
type: entity
table: h_orders
fields:
id:
id: true
type: integer
unsigned: false
nullable: false
generator:
strategy: IDENTITY
scode:
type: integer
unsigned: false
nullable: false
[-- skipped --]
oneToMany:
payments:
targetEntity: Entities\Payment
mappedBy: order
When I try to fetch Order from Payment with lazy loading I receive empty Order object with null properties. If I use eager fetching Order object is valid.
SQL generated for lazy loading seems to be valid, so I suppose the problem is in mapping result to the object. At the same time lazy loading works fine with 2.0.6 version.
Another problem appears while persisting new Payment.
$payment = new \Entities\Payment(); ... $order = $this->em->getRepository('\Entities\Order')->find(46320); $payment->setOrder($order); $order->addPayments($payment); $this->em->persist($payment); $this->em->flush();
I get this error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'scode' cannot be null' in /usr/share/php/Doctrine/DBAL/Statement.php:131
I found issue which is still open and looks like mine – http://www.doctrine-project.org/jira/browse/DDC-1114. What do you think about this?
Issue Links
- is referenced by
-
DDC-1114
Association on a non primary key field - fix the commit order
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
We have association on non primary key. Something like this: Entities\Payment: type: entity table: payments fields: id: id: true type: integer nullable: false generator: strategy: IDENTITY [-- skipped --] manyToOne: order: targetEntity: Entities\Order inversedBy: payments joinColumn: name: scode referencedColumnName: scode Entities\Order: type: entity table: h_orders fields: id: id: true type: integer unsigned: false nullable: false generator: strategy: IDENTITY scode: type: integer unsigned: false nullable: false [-- skipped --] oneToMany: payments: targetEntity: Entities\Payment mappedBy: order When I try to fetch Order from Payment with lazy loading I receive empty Order object with null properties. If I use eager fetching Order object is valid. SQL generated for lazy loading seems to be valid, so I suppose the problem is in mapping result to the object. At the same time lazy loading works fine with 2.0.6 version. Another problem appears while persisting new Payment. $payment = new \Entities\Payment(); ... $order = $this->em->getRepository('\Entities\Order')->find(46320); $payment->setOrder($order); $order->addPayments($payment); $this->em->persist($payment); $this->em->flush(); I get this error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'scode' cannot be null' in /usr/share/php/Doctrine/DBAL/Statement.php:131 I found issue which is still open and looks like mine -- http://www.doctrine-project.org/jira/browse/DDC-1114. What do you think about this? |
We have association on non primary key. Something like this: {code} Entities\Payment: type: entity table: payments fields: id: id: true type: integer nullable: false generator: strategy: IDENTITY [-- skipped --] manyToOne: order: targetEntity: Entities\Order inversedBy: payments joinColumn: name: scode referencedColumnName: scode {code} {code} Entities\Order: type: entity table: h_orders fields: id: id: true type: integer unsigned: false nullable: false generator: strategy: IDENTITY scode: type: integer unsigned: false nullable: false [-- skipped --] oneToMany: payments: targetEntity: Entities\Payment mappedBy: order {code} When I try to fetch Order from Payment with lazy loading I receive empty Order object with null properties. If I use eager fetching Order object is valid. SQL generated for lazy loading seems to be valid, so I suppose the problem is in mapping result to the object. At the same time lazy loading works fine with 2.0.6 version. Another problem appears while persisting new Payment. {code} $payment = new \Entities\Payment(); ... $order = $this->em->getRepository('\Entities\Order')->find(46320); $payment->setOrder($order); $order->addPayments($payment); $this->em->persist($payment); $this->em->flush(); {code} I get this error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'scode' cannot be null' in /usr/share/php/Doctrine/DBAL/Statement.php:131 I found issue which is still open and looks like mine -- http://www.doctrine-project.org/jira/browse/DDC-1114. What do you think about this? |
| Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
| Workflow | jira [ 12813 ] | jira-feedback [ 13951 ] |
| Workflow | jira-feedback [ 13951 ] | jira-feedback2 [ 15815 ] |
| Workflow | jira-feedback2 [ 15815 ] | jira-feedback3 [ 18071 ] |
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1269, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
Formatting, please add a second ticket for the second issue.