protected function proceedApproval(array $approval, array $patchset)
    {
        $by = $this->proceedPerson($approval['by']);

        $approvalData = array(
            'patchset' => $patchset['id'],
            'type' => $approval['type'],
            'description' => ((isset($approval['description']) === true) ? $approval['description'] : ''),
            'value' => $approval['value'],
            'granted_on' => $approval['grantedOn'],
            'by' => $by['id'],
            'voted_earlier' => 0
        );

        // An approval don`t have a unique identifier, so we must generate one on our own.
        // Patch-ID, type and user. This combination is "unique enough".
        // Is this approval already in database?
        $approvalRow = $this->getGerritApprovalByIdentifier($patchset['id'], $approval['type'], $by['id']);
        if ($approvalRow === false) {
            $this->getDatabase()->insertRecord(Database::TABLE_APPROVAL, $approvalData);

            // We know this approval. Just update it!
        } else {
            $this->checkIfServersFirstRun('Approval', 1363897318, array($approval, $approvalRow));

            $this->getDatabase()->updateRecord(Database::TABLE_APPROVAL, $approvalData, $approvalRow['id']);
        }

        $approval = $this->unsetKeys($approval, array('type', 'description', 'value', 'grantedOn', 'by'));
        $this->checkIfAllValuesWereProceeded($approval, 'Approval');

        unset($approval);
    }
protected function proceedApproval(array $approval, array $patchset)
    {
        $by = $this->proceedPerson($approval['by']);

        $approvalData = array(
            'patchset' => $patchset['id'],
            'type' => $approval['type'],
            'description' => ((isset($approval['description']) === true) ? $approval['description'] : ''),
            'value' => $approval['value'],
            'granted_on' => $approval['grantedOn'],
            'by' => $by['id'],
            'voted_earlier' => 0
        );

        // An approval don`t have a unique identifier, so we must generate one on our own.
        // Patch-ID, type and user. This combination is "unique enough".
        // Is this approval already in database?
        $approvalRow = $this->getGerritApprovalByIdentifier($patchset['id'], $approval['type'], $by['id']);
        if ($approvalRow === false) {
            $this->getDatabase()->insertRecord(Database::TABLE_APPROVAL, $approvalData);

            // We know this approval. Just update it!
        } else {
            $this->checkIfServersFirstRun('Approval', 1363897318, array($approval, $approvalRow));

            $this->getDatabase()->updateRecord(Database::TABLE_APPROVAL, $approvalData, $approvalRow['id']);
        }

        $approval = $this->unsetKeys($approval, array('type', 'description', 'value', 'grantedOn', 'by'));
        $this->checkIfAllValuesWereProceeded($approval, 'Approval');

        unset($approval);
    }
protected function proceedApproval ( array $ approval , array $ patchset ) { $ by = $ this -> proceedPerson ( $ approval [ 'by' ] ) ; $ approvalData = array ( 'patchset' => $ patchset [ 'id' ] , 'type' => $ approval [ 'type' ] , 'description' => ( ( isset ( $ approval [ 'description' ] ) === true ) ? $ approval [ 'description' ] : '' ) , 'value' => $ approval [ 'value' ] , 'granted_on' => $ approval [ 'grantedOn' ] , 'by' => $ by [ 'id' ] , 'voted_earlier' => 0 ) ; // An approval don`t have a unique identifier, so we must generate one on our own. // Patch-ID, type and user. This combination is "unique enough". // Is this approval already in database? $ approvalRow = $ this -> getGerritApprovalByIdentifier ( $ patchset [ 'id' ] , $ approval [ 'type' ] , $ by [ 'id' ] ) ; if ( $ approvalRow === false ) { $ this -> getDatabase ( ) -> insertRecord ( Database :: TABLE_APPROVAL , $ approvalData ) ; // We know this approval. Just update it! } else { $ this -> checkIfServersFirstRun ( 'Approval' , 1363897318 , array ( $ approval , $ approvalRow ) ) ; $ this -> getDatabase ( ) -> updateRecord ( Database :: TABLE_APPROVAL , $ approvalData , $ approvalRow [ 'id' ] ) ; } $ approval = $ this -> unsetKeys ( $ approval , array ( 'type' , 'description' , 'value' , 'grantedOn' , 'by' ) ) ; $ this -> checkIfAllValuesWereProceeded ( $ approval , 'Approval' ) ; unset ( $ approval ) ; }
Will proceed a single approval.

@param array $approval The current approval
@param array $patchset The current patchset
@return void
Will proceed a single approval .