1

i'm using Parse.com with the library for PHP and i wanna get all columns for a pointer to Product in my class RepProdMae, my code is below, but i don't know how obtine all columns, thanks for your help.

    $pqry = new parseQuery('RepProdMae') ;
    $pqry->whereInclude("Product") ;
    $pqry->wherePointer('productId','Product', 'lqf4mmpOgS') ;
    $pres = $pqry->find() ;

    print_r($pres) ;

this print_r return:

 stdClass Object
 (
     [results] => Array
        (
        [0] => stdClass Object
            (
                [userId] => stdClass Object
                    (
                        [__type] => Pointer
                        [className] => _User
                        [objectId] => 3YjQkMwrvf
                    )

                [productId] => stdClass Object
                    (
                        [__type] => Pointer
                        [className] => Product
                        [objectId] => lqf4mmpOgS
                    )

                [comments] => nothing
                [createdAt] => 2014-07-16T01:44:41.549Z
                [updatedAt] => 2014-07-16T01:44:41.549Z
                [objectId] => 6VzG9K1BTS
            )
       )
   )

And my product class have more colums, my query array is :

Array
(
  [where] => {"productId":{"__type":"Pointer","className":"Product","objectId":"lqf4mmpOgS"}}
  [include] => Product
  [limit] => 100
)

1 Answer 1

2

Your parameter for the Include method should be the column name which is a pointer, not the class name which is pointed to.

Try changing this line:

$pqry->whereInclude("productId") ;
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks you so much @Fosco with this change works fine
Sorry I have other question, if i wanna go to a second or third level is posible? eg, my first class RepProdMae have a pointer to Product this have a pointer to SubCategory and this other for Category, how can do with WhereInclude or what other thing can do, considering also i can't use a value for my actual query for a wherePointer $pqry->wherePointer('productId.CategoriId','Category', thisquery.ProductId.CategoryId) ;
I don't think you can go multiple levels with the Where, only the Include ( productId.categoryId ). For querying on nested objects, you'd have to use a method for 'matches query' which I'm not sure is implemented in the library you're using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.