Bug #29484
Adding a primaryElectronicAddress to a person throws an duplicate key error
| Status: | Resolved | Start date: | 2011-09-05 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assignee: | Christian Mueller | % Done: | 100% |
|
| Category: | - | |||
| Target version: | - | |||
| FLOW3 version affected: | FLOW3 1.0.0 | |||
| Votes: | 0 |
Description
When I add a electronicAddress to a person by setting the electronicAddress as primaryElectronic Address (setPrimaryElectronicAddress()), everything works fine if this is done for the first time.
If I then change the PrimaryElectronicAddress to another ElectronicAddress I get a changed PrimaryElectronicAddress
and a second ElectronicAddress added to the already existing ElectronicAddresses.
So far everything is o.k.
If i then try to change the PrimaryElectronicAddress back to the one I initially had set as PrimaryElectronicAddress by selecting that ElectronicAddress from a list of ElectronicAddresses an Error 'duplicate Key in Table typo3_domain_model_party_electronicaddresses_join' is thrown.
If I change the method "setPrimaryElectronicAddress" as follows everything works fine.
/**
* Sets (and adds if necessary) the primary electronic address of this person.
*
* @param \TYPO3\Party\Domain\Model\ElectronicAddress $electronicAddress The electronic address
* @return void
* @author Robert Lemke <robert@typo3.org>
*/
public function setPrimaryElectronicAddress(\TYPO3\Party\Domain\Model\ElectronicAddress $electronicAddress) {
$this->electronicAddresses->removeElement($this->getPrimaryElectronicAddress());
$this->primaryElectronicAddress = $electronicAddress;
$this->electronicAddresses->add($electronicAddress);
}
Related issues
| related to TYPO3.Flow - Bug #37507: Doctrine Collection add existing | Closed | 2012-05-26 | ||
| related to TYPO3.Party - Bug #37628: Duplicate entries exception for electronicAddresses by ad... | Resolved | 2012-05-31 |
Associated revisions
[BUGFIX] PrimaryElectronicAddress should check before adding
With setPrimaryElectronicAddress the electronic address is also
added to the electronicAddress collection but it should check
first if it is already in to avoid creating duplicate entries.
Change-Id: Ib62cd74daff9f0e4d97ca738aab414fa9581e65b
Fixes: #29484
Releases: 1.0, 1.1
History
Updated by Karsten Dambekalns over 1 year ago
- FLOW3 version affected set to FLOW3 1.0.0
Updated by Gerrit Code Review about 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10155
Updated by Christian Mueller about 1 year ago
- Assignee set to Christian Mueller
Updated by Gerrit Code Review about 1 year ago
Patch set 1 for branch FLOW3-1.0 has been pushed to the review server.
It is available at http://review.typo3.org/11078
Updated by Christian Mueller about 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 736f2ecbe68d7d85832ff21ddc84e8cb8663b4b6.