Answer the question
In order to leave comments, you need to log in
How to access an element of an object that is in an array?
Hello!
I have an array like this
array(2) {
[0]=>
object(Shop\Entity\Category)#250 (3) {
["id":protected]=>
int(13)
["parentId":protected]=>
string(1) "1"
["category":protected]=>
string(24) "Однополюсные"
}
[1]=>
object(Shop\Entity\Category)#276 (3) {
["id":protected]=>
int(14)
["parentId":protected]=>
string(1) "1"
["category":protected]=>
string(24) "Двухполюсные"
}
}
Answer the question
In order to leave comments, you need to log in
user_zaim(models.Model)
user_zaim = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True,
blank=True, default= None)
If the array is stuffed into the $arr variable, then most likely so
But not a fact.
The fact is that you have an array of objects for which all parameters are not available from outside, and if this object does not have heteros or any other functions for displaying parameters, then these parameters cannot be obtained.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question