Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

FindBy where column valeu is null

I'm trying to fill a selectbox with projects that dont have a delivered date yet, these projects have the value in the 'delivered date' column set to the default value 'null'

I cannot seem to figure out which parameters to use the make it search for 'where value = null'

This is how it looks right now, it doesnt return anything

$project = new Select('project_id', Project::findByDeliveredDate('null'), [
      'using'      => ['id', 'name'],
      'useEmpty'   => true,
      'emptyText'  => 'Select project',
       'emptyValue' => '',
        'class'      => 'form-control select2',
]);

I also tried

    $project = new Select('project_id', $this->modelsManager->createQuery("SELECT * FROM \PhalconTime\Models\Project WHERE delivered_date != 'null'")->execute(), [
     'using'      => ['id', 'name'],
      'useEmpty'   => true,
      'emptyText'  => 'Select project',
       'emptyValue' => '',
        'class'      => 'form-control select2',
]);


10.6k
Accepted
answer
Project::find([
    'conditions'=>'delivered_date is not null'
]);


8.1k

Thanks a lot both.

Both work but i accepted corentin-begne answer because thats the solution I implemented.