• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inheritance ERRest
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inheritance ERRest


  • Subject: Re: Inheritance ERRest
  • From: Pascal Robert <email@hidden>
  • Date: Thu, 05 Dec 2013 07:43:52 -0600 (CST)
  • Thread-topic: Inheritance ERRest

Beside running the ERRestRouteExample app to see if anything is broken, not much other way to verify.

----- Mail original -----
De: "Henrique Prange" <email@hidden>
À: email@hidden
Cc: "Elizio Marcelino" <email@hidden>
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@hidden > 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@hidden )
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

</blockquote>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Inheritance ERRest
      • From: Henrique Prange <email@hidden>
References: 
 >Inheritance ERRest (From: Elizio Marcelino <email@hidden>)
 >Re: Inheritance ERRest (From: Henrique Prange <email@hidden>)

  • Prev by Date: Re: ERRest security
  • Next by Date: Re: processRecentChanges makes me sad
  • Previous by thread: Re: Inheritance ERRest
  • Next by thread: Re: Inheritance ERRest
  • Index(es):
    • Date
    • Thread