Where clause Or operators and grouping

Where clause Or operators and grouping

lavanyeswarilavanyeswari Posts: 1Questions: 1Answers: 0
edited August 2016 in Free community support

hi ,
i am using Where clause Or operators in my php file,it is displaying correctly,but when iam updating the changes are not reflecting back ,but when i use only where clause without any or operators it is working fine

'Below is my php file
<?php

include( "../editor/php/DataTables.php" );

use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Upload,
DataTables\Editor\Validate;

// Build our Editor instance and process the data coming from _POST
$editor=Editor::inst( $db, 'userdetails','user_id' )
->fields(
Field::inst( 'firstname' )->validator( 'Validate::notEmpty' ),
Field::inst( 'lastname' )->validator( 'Validate::notEmpty' ),
Field::inst( 'email' )->validator( 'Validate::notEmpty' ),
Field::inst( 'company_name' )->validator( 'Validate::notEmpty' ),
Field::inst( 'role_name' )
->options( 'roledetails', 'role_name', 'role_name' )
->validator( 'Validate::notEmpty' ),
Field::inst( 'phoneNo' )
->validator( 'Validate::numeric' )
->setFormatter( 'Format::ifEmpty', null ),
Field::inst( 'active' ),
Field::inst( 'stype' )
->options( 'subscription', 'sub_type', 'sub_type' )
->validator( 'Validate::notEmpty' )

);

/* need to select rows where rolenum or stype is null*/

    $editor->where( function ( $q ) {
        $q
        ->where( 'role_name', null )
        ->or_where( function ( $r ) {
            $r->where( 'stype', null  );

        } );
    } );

$editor ->process( $_POST );
$editor  ->json();
?>

Answers

  • bpitonibpitoni Posts: 21Questions: 7Answers: 2

    I am also having this exact issue.
    the "or_where" seems to break the default automatic "refresh" that normally occurs after a row edit

This discussion has been closed.