Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_class() expects parameter 1 to be object, array given getting this error while trying to insert data in product table #173

Open
dsv4890 opened this issue Jul 16, 2018 · 22 comments

Comments

@dsv4890
Copy link

dsv4890 commented Jul 16, 2018

No description provided.

@dsv4890
Copy link
Author

dsv4890 commented Jul 17, 2018

I'm sending data using post request as array. Is there any particular format in which we have to pass data for insert

@CyberiaResurrection
Copy link
Contributor

@dsv4890 , what data are you trying to post, and to which route? That looks suspiciously like the tail end of an error message.

Are you running against dev-master or 0.3.* of POData-Laravel?

@dsv4890
Copy link
Author

dsv4890 commented Jul 17, 2018

I am posting on route http://127.0.0.1:8000/odata.svc/Products using Post method
@c-harris i am sending data in JSON format

@dsv4890
Copy link
Author

dsv4890 commented Jul 17, 2018

ok

@dsv4890
Copy link
Author

dsv4890 commented Jul 18, 2018

@CyberiaResurrection I am running both dev-master and 0.3.* in separate projects but not getting any solution how to post data for crud operation using this package

@CyberiaResurrection
Copy link
Contributor

@dsv4890 , thanks for the reply. I strongly suspect the cause (see @c-harris comment above), but if you can, could you try submitting your post request in atom format, rather than json?

@dsv4890
Copy link
Author

dsv4890 commented Jul 18, 2018

I have tried to send the response in atom formate and I'm getting an error
The array type must be specified as "array<K, V>" for Key-Value-Pairs.

@CyberiaResurrection
Copy link
Contributor

@dsv4890 , thanks for trying that. What client are you using to send the requests?

@dsv4890
Copy link
Author

dsv4890 commented Jul 18, 2018

postman

@dsv4890
Copy link
Author

dsv4890 commented Jul 18, 2018

Can you please provide any kind of example or sample data for post request!

@CyberiaResurrection
Copy link
Contributor

It looks like you might have tripped over a difference in JMS serialiser versions - to check, you're running minimum-stability: dev on both your test projects?

I've pushed a fix to the odata-metadata project - can you please composer update and see what pain persists?

@dsv4890
Copy link
Author

dsv4890 commented Jul 18, 2018

ok

@dsv4890
Copy link
Author

dsv4890 commented Jul 18, 2018

I have run composer update command but still getting the same error
It would be good if you can send me demo data so i can verify I'm inserting data in proper format

@CyberiaResurrection
Copy link
Contributor

OK, here's the best I can find on line (from the OData v3 dox - http://www.odata.org/documentation/odata-version-3-0/atom-format/ , section 6.1) for atom format:

<entry>
  <id>http://services.odata.org/OData/OData.svc/Products(0)</id> 
  <title /> 
  <summary /> 
  <updated>2012-03-30T07:11:05Z</updated> 
  <author>
    <name /> 
  </author>
  <link rel="edit" title="Product" href="Products(0)" /> 
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=entry" title="Category" href="Products(0)/Category" /> 
  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(0)/Supplier" /> 
  <category term="ODataDemo.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
  <content type="application/xml">
    <metadata:properties>
      <data:ID m:type="Edm.Int32">0</data:ID> 
      <data:Name>Bread</data:Name>
      <data:Description>Whole grain bread</data:Description>
      <data:ReleaseDate metadata:type="Edm.DateTime">1992-01-01T00:00:00</data:ReleaseDate> 
      <data:DiscontinuedDate metadata:type="Edm.DateTime" metadata:null="true" /> 
      <data:Rating metadata:type="Edm.Int32">4</data:Rating> 
      <data:Price metadata:type="Edm.Decimal">2.5</data:Price> 
    </metadata:properties>
  </content>
</entry>

@dsv4890
Copy link
Author

dsv4890 commented Jul 19, 2018

sending data in the same format i'm getting following error
assert (): Property content must be instanceof ODataPropertyContent. failed

when i'm trying to use this in 0.3.* project i'm getting following error
Call to a member function getValue() on null
at vendor\algo-web\o-data-metadata\src\MetadataManager.php

@dsv4890
Copy link
Author

dsv4890 commented Jul 24, 2018

Is crud operation not possible using this package?
Can I please get an update about POST method URL...

@dsv4890 dsv4890 closed this as completed Jul 24, 2018
@dsv4890 dsv4890 reopened this Jul 24, 2018
@dsv4890
Copy link
Author

dsv4890 commented Sep 21, 2018

Hi
I'm waiting for a response on my issue about POST request
error get_class() expects parameter 1 to be object, array given

@dsv4890
Copy link
Author

dsv4890 commented Sep 21, 2018

ok Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@CyberiaResurrection @dsv4890 and others