Пример #1
0
 /**
  * @return array
  */
 public function parseObjectToArray(ParseObject $object)
 {
     $array = $object->getAllKeys();
     $array['objectId'] = $object->getObjectId();
     $createdAt = $object->getCreatedAt();
     if ($createdAt) {
         $array['createdAt'] = $this->dateToString($createdAt);
     }
     $updatedAt = $object->getUpdatedAt();
     if ($updatedAt) {
         $array['updatedAt'] = $this->dateToString($updatedAt);
     }
     if ($object->getACL()) {
         $array['ACL'] = $object->getACL()->_encode();
     }
     foreach ($array as $key => $value) {
         if ($value instanceof ParseObject) {
             if ($value->getClassName() == $this->parseObject->getClassName() && $value->getObjectId() == $this->parseObject->getObjectId()) {
                 // If a key points to this parent object, we will skip it to avoid
                 // infinite recursion.
             } elseif ($value->isDataAvailable()) {
                 $array[$key] = $this->parseObjectToArray($value);
             }
         } elseif ($value instanceof ParseFile) {
             $array[$key] = $value->_encode();
         }
     }
     return $array;
 }