2016-06-18 5 views
0

私はクライアントのexpires_atを変更したいのですが、persist($ client)とflush(); setExpiresAt()を除いて、すべてのメソッドが正常に動作しますが、これはtableの値を変更しません。

$client = $em->getRepository('ClientBundle:Client')->FindClient($id); 

$expiresat = $client->getExpiresAt(); // the can see the (*) 
$expiresat->modify($durationcontract); 
$client->setExpiresAt($expiresat); 

// $durationcontract can be 6 months or one year 
$client->setDuration($durationcontract); 

$em->persist($client); 
$em->flush(); 

(*)は、この方法では、私が作成したクラスのユーザーまたはFOSUserBundleその中には存在しません。あなたはそれを見ることができますhere

+0

の$ durationcontractは何ですか? –

+0

クライアントの契約期間は6ヶ月または1年になる可能性があります。 –

+0

したがって、「+6月」または「+1年」の権利ですか? –

答えて

0

多分Doctrineはオブジェクト間の違いを見ません。だから、

、これを試してみてください。

$expiresat = $client->getExpiresAt(); 
$expiresat = clone $expiresat; 
$expiresat->modify($durationcontract); 
$client->setExpiresAt($expiresat); 
関連する問題