[FLOW3-general] Extending Person, problems deleting
Thomas Plessis
t.plessis at totemnumerique.com
Tue Nov 22 18:09:54 CET 2011
Hi Mathias,
Like you, i've a "Member" class with extends "Person". But i've trouble to update my memberRepository. I got the following error :
#23000: SQLSTATE[23000]: Integrity
constraint violation: 1062 Duplicate entry
'b1eb8d7b-8918-4b44-b50b-0797c7a42d48-011b392c-c85d-41ee-8dfa-e77' for
key 'PRIMARY'
And the strange request that FLOW3 try to do :
Doctrine\DBAL\Connection::executeUpdate("INSERT INTO typo3_party_domain_model_person_electr…rty_person, party_electronicaddress) VALUES (?, ?)", array)
INSERT? why not an update??
Here is my update action :
public function updateAction(\Totem\Lewin\Domain\Model\Member $member) {
$this->memberRepository->update($member);
$this->addFlashMessage('This member has been updated.');
$this->redirect('editProfile');
}
regards,
Thomas Plessis
Hi Christian!
Thanks! Deleting the account worked! :-D
Mathias Bolt Lesniak
LiliO - www.lilio.no
mathias at lilio.com
On 23. sep. 2011, at 18:58, Christian Müller (Kitsunet) wrote:
> Actually it should be enough to remove the account from the accountRepository. Entities should define some cascading normally so if you delete from the right end it should trigger deletion of everything below that (As should be for an Aggregrate Root according to Domain Driven Design).
>
> All the Best,
> Christian
>
>
> On 22/09/11 11:57, Mathias Bolt Lesniak, LiliO Design wrote:
>> Hi!
>>
>> I'm working on my first proper FLOW3 project, so let it be said: I'm a newbie.
>>
>> I wanted to extend \TYPO3\Party\Domain\Model\Person and created a class called User. It works fine, except from when I want to delete an instance. I thought I should be able to just call "$this->userRepository->remove($user);", but I keep getting exceptions about "foreign key constraint fails".
>>
>> #23000: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`testdb_test`.`typo3_flow3_security_account`, CONSTRAINT `typo3_flow3_security_account_ibfk_1` FOREIGN KEY (`party_abstractparty`) REFERENCES `typo3_party_domain_model_abstractparty` (`flow3_)
>>
>> Do I really have to delete every single relation manually?
>>
>>
>> Thanks for all help!
>>
>> Best wishes
>>
>> Mathias Bolt Lesniak
>> LiliO - www.lilio.no
>> mathias at lilio.com
>>
>>
>>
>>
>
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
More information about the FLOW3-general
mailing list