Thank you Pascal. I'm going to take a look at this sample project. Cheers,
Henrique Sent from my iPad > On 05/12/2013, at 11:43, Pascal Robert <[email protected]> wrote: > > Beside running the ERRestRouteExample app to see if anything is broken, not > much other way to verify. > > ----- Mail original ----- > De: "Henrique Prange" <[email protected]> > À: [email protected] > Cc: "Elizio Marcelino" <[email protected]> > Envoyé: Mercredi 4 Décembre 2013 08:42:09 > Objet: Re: Inheritance ERRest > > Hi all, > > We've found out this is a bug. The ERRestRequestNode ignores the type field > when creating objects for toOne and toMany relationships. We're going to > create a pull request to fix this problem soon. > > BTW, is there a way to verify we didn't introduce a bug in ERRest while > trying to fix another one? > > Cheers, > > Henrique > > Sent from my iPhone > > On 02/12/2013, at 22:41, Elizio Marcelino < [email protected] > > wrote: > > > > > Hi, > > > I'm having trouble working with ERRest and EO with inheritance. > > I have the following structure in my EO Model. > > Order > - id > - quantity > - NSArray<AbstractPayment> payments > > > AbstractPayment > - id - autoIncrement > - status > > CreditCardPayment extends AbstractPayment > - amount > - installments > > DebitCardPayment extends AbstractPayment > - number > - holder > > In my REST API, in my class OrderController doing well CreateAction: > > public WOActionResults createAction() throws Throwable { > Order order = (Order)create(entityName(), filterWithAllRecursive()); > } > > I am making the following call with rest: > > { > "status":"created", > "payments": [ > { > "type": " CreditCardPayment" > "amount":100 > "instalments": 1 > } > ] > } > > If you notice my class CreditCardPayment extends AbstractPayment, and when I > send my request to the list of payment am having the following error: > > > < com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException message > '<AbstractPayment 0x7656e376> takeValueForKey(): attempt to assign value to > unknown key: 'amount'. > This class does not have an instance variable of the name amount or _amount, > nor a method of the name setAmount or _setAmount' object '<AbstractPayment > pk:"null">' key 'amount'> > > > I believe when it is done trying to convert JSON to the Order object it is > trying to convert the List of payment for AbstractPayment and not to > CreditCardPayment. > > How can we show to create what should be done by CreditCardPayment > DebitCartPayment or not by AbstractPayment? > > > > Thank you. > Elizio > > > > > <blockquote> > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list ( [email protected] ) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com > > This email sent to [email protected] > > </blockquote> > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list ([email protected]) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca > > This email sent to [email protected] > _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
