0

Symfony2 アプリで特定のイベントの後に通知を保存したいと考えています。通知エンティティを作成しましたが、他のエンティティで aftersave イベントをトリガーして新しい通知レコードを作成する方法がわかりません。

CakePHP では、このようなものを他のモデルに追加します

function afterSave( )
{
    App::import( 'Model', 'Notification' );
    $Notification = new Notification;

    $notification = array( 'Notification' => array(
        'person_id' => Person::get( 'Person.id' ),
        'type' => 'foo',
        'title' => 'bar',
        'details' => 'lorem ipsum'
    ) );

    $Notification->save( $notification );
}
4

1 に答える 1