public function createBody()
    {
        $body = array(
            'isDestructive' => $this->removesRows,
            'isError' => $this->isError(),
            'isWarning' => false,
            'message' => $this->message,
            'successClasses' => $this->successClasses,
            'failedClasses' => $this->failedClasses
        );

        if (!$this->isError()) {
            $body['records'] = array(
                'success' => array(),
                'failed' => array()
            );

            foreach ($this->successRecords as $record) {
                $data = array('id' => $record->ID, 'class' => $record->ClassName);
                if (!$this->removesRows) {
                    $data['row'] = $this->getRecordGridfieldRow($record);
                }
                $body['records']['success'][] = $data;
            }

            $body['records']['failed'] = $this->failedRecords;
        }

        if (count($body['records']['success']) === 0) {
            $body['isWarning'] = true;
        }

        $this->body = Convert::raw2json($body);
    }
public function createBody()
    {
        $body = array(
            'isDestructive' => $this->removesRows,
            'isError' => $this->isError(),
            'isWarning' => false,
            'message' => $this->message,
            'successClasses' => $this->successClasses,
            'failedClasses' => $this->failedClasses
        );

        if (!$this->isError()) {
            $body['records'] = array(
                'success' => array(),
                'failed' => array()
            );

            foreach ($this->successRecords as $record) {
                $data = array('id' => $record->ID, 'class' => $record->ClassName);
                if (!$this->removesRows) {
                    $data['row'] = $this->getRecordGridfieldRow($record);
                }
                $body['records']['success'][] = $data;
            }

            $body['records']['failed'] = $this->failedRecords;
        }

        if (count($body['records']['success']) === 0) {
            $body['isWarning'] = true;
        }

        $this->body = Convert::raw2json($body);
    }
public function createBody ( ) { $ body = array ( 'isDestructive' => $ this -> removesRows , 'isError' => $ this -> isError ( ) , 'isWarning' => false , 'message' => $ this -> message , 'successClasses' => $ this -> successClasses , 'failedClasses' => $ this -> failedClasses ) ; if ( ! $ this -> isError ( ) ) { $ body [ 'records' ] = array ( 'success' => array ( ) , 'failed' => array ( ) ) ; foreach ( $ this -> successRecords as $ record ) { $ data = array ( 'id' => $ record -> ID , 'class' => $ record -> ClassName ) ; if ( ! $ this -> removesRows ) { $ data [ 'row' ] = $ this -> getRecordGridfieldRow ( $ record ) ; } $ body [ 'records' ] [ 'success' ] [ ] = $ data ; } $ body [ 'records' ] [ 'failed' ] = $ this -> failedRecords ; } if ( count ( $ body [ 'records' ] [ 'success' ] ) === 0 ) { $ body [ 'isWarning' ] = true ; } $ this -> body = Convert :: raw2json ( $ body ) ; }
Creates the response JSON body
Creates the response JSON body