2012-01-06 5 views
0

フロー3のセキュリティアカウント/パーティモジュールに問題があります。フロー3人名ロールバック

私は党としての人の最初と最後の名前を変更しようとしました:

$person = $account->getParty(); 
$name = $person->getName(); 
$name->setFirstName($firstName); 
$name->setLastName($lastName); 
$this->accountRepository->update($account); 
$this->partyRepository->update($person); 

$アカウントが有効\TYPO3\FLOW3\Security\Accountオブジェクトです。

このコードを使用して$ firstNameと$ lastnameを変更すると、flow3はロールバックしています。

私は回避策が見つかりました:

$personName = new \TYPO3\Party\Domain\Model\PersonName('', $firstName,'', $lastName); 
$person->setName($personName); 

これが正常に動作しますが、なぜ?

答えて

1

Person::getName()PersonNameのコピーを返します。つまり、外部($name)に変更すると、PersonNameは$personの内部($this->name)に更新されません。

これは一つの解決策のようになります。

$person = $account->getParty(); 
$name = $person->getName(); 
$name->setFirstName($firstName); 
$name->setLastName($lastName); 
$person->setName($name); 
$this->accountRepository->update($account); 
$this->partyRepository->update($person); 

もう一度PersonNameのを設定します。

このanwserはあまりにもいいです:https://stackoverflow.com/a/746322/782920

PHP:参照によって返す:http://php.net/manual/en/language.references.return.php