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: | ||
Assigned To: | Christian Müller | % Done: | 100% |
|
Category: | - | |||
Target version: | - | |||
Affected Flow version: | FLOW3 1.0.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
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: I1be2ef15ebb0fbe1a021ebb045c63fda59793252
Fixes: #29484
Releases: 1.0, 1.1
[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
#1 Updated by Karsten Dambekalns almost 4 years ago
- Affected Flow version set to FLOW3 1.0.0
#2 Updated by Gerrit Code Review over 3 years 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
#3 Updated by Christian Müller over 3 years ago
- Assigned To set to Christian Müller
#4 Updated by Gerrit Code Review about 3 years 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
#5 Updated by Christian Müller about 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 736f2ecbe68d7d85832ff21ddc84e8cb8663b4b6.