Mailing List webobjects-dev@wocommunity.org Messaggio #115
Da: Ricardo Parada <webobjects-dev@wocommunity.org>
Oggetto: Re: [WO-DEV] ERXCopyable.CopyType = Nullify on to-many relationship should empty instead
Data: Thu, 25 Mar 2021 13:25:00 -0400
A: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
I think ERXCopyable.java: 1286 should be changed to something like this:

case NULLIFY:
    // Only set to-one relationships to null. For to-many relationships we leave it alone with the empty array setup during the creation of the EO
    if (!relationship.isToMany()) {
        destination.takeStoredValueForKey(null, relationshipName);
    }




On Mar 25, 2021, at 1:02 PM, Ricardo Parada <webobjects-dev@wocommunity.org> wrote:

Hello everyone,

I like that in Wonder when you create an EO all the to-many relationships are initialized to an empty array because it means that I don’t have to worry about null checking every time I access the to-many relationship in order to avoid NullPointerExceptions. 

However, if I create my EO by copying an existing one using ERXCopyable then any to-many relationships that have ERXCopyable.CopyType set to Nullify will be set to null. 

Wouldn’t it be better to set them to an empty array? Or should we have an Emptify option?

Thanks
Ricardo Parada
Iscrizione modo messaggi Iscrizione modo riassunto Iscrizione modo index Cancella Scrivi al Listmaster