bitmatix Posted August 10, 2012 Share Posted August 10, 2012 Hi there, I'm trying to do the following: $array = new WireArray(); $array->set('test',123); but I always get an error: Error Exception: Item 'test' set to WireArray is not an allowed type What am I doing wrong? Thanks a lot! 1 Link to comment Share on other sites More sharing options...
WillyC Posted August 10, 2012 Share Posted August 10, 2012 Wire.array only take obje t of type Wire. 123 is number.not wire use.a reaglar php array insteade Link to comment Share on other sites More sharing options...
ryan Posted August 10, 2012 Share Posted August 10, 2012 That's correct. Just to reiterate what WIllyC was trying to communicate -- WireArray is an Array meant to store Wire objects. If you need to store something else, then regular PHP array is your best bet. 1 Link to comment Share on other sites More sharing options...
bitmatix Posted August 10, 2012 Author Share Posted August 10, 2012 Thank you guys, for your fast replies. What I'm trying to do is the following: I'm getting some data from an external webservice and I'm trying to "convert" it to a WireArray (maybe something else), to have the ability to search in this data, without storing the data/items as pages. What I want to have, is the ability to search in the data of the webservice as described in the "Arrays" section of the API documentation. Link to comment Share on other sites More sharing options...
adamspruijt Posted January 3, 2019 Share Posted January 3, 2019 I landed here from a somewhat related issue I was having. The API now supports strings, objects, ints and arrays as valid. LINK 1 Link to comment Share on other sites More sharing options...
szabesz Posted January 17, 2019 Share Posted January 17, 2019 On 1/3/2019 at 5:26 PM, adamspruijt said: The API now supports strings, objects, ints and arrays as valid. Introduced in ProcessWire 3.0.117https://processwire.com/blog/posts/processwire-3.0.117-core-updates/ 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now