allow null on relation

Dear All,

I have a situation like this, two tables, BankAccount and Payment. Payment have bankAccountFk where referred to BankAccount(id). However, when creating, the bankAccountFk may initially set to null. Once, the payment is sent to the bank, it will be updated. How could I achieve this?

Cheers,

Daniel

I think there is no problem to set bankAccountFk property null in code(Yii particular). You only need to validate the relation whether it is null or not before access them.

Hi junxiong,

If I set the bankAccountFk as null I cannot make the relation to BankAccount(id). Could you explain more on this?

Cheers,

Daniel