Andrew Myers
Andrew Myers

Reputation: 461

CakePHP find command warnings when calling find despite return data correctly

I'm getting the following errors:

Warning (2): array_keys() expects parameter 1 to be array, null given [CORE\Cake\Model\Datasource\DboSource.php, line 2181]

Warning (2): array_filter() expects parameter 1 to be array, null given [CORE\Cake\Model\Datasource\DboSource.php, line 2185]

Warning (2): array_values() expects parameter 1 to be array, null given [CORE\Cake\Model\Datasource\DboSource.php, line 2185]

Warning (2): array_unique() expects parameter 1 to be array, null given [CORE\Cake\Model\Datasource\DboSource.php, line 2264]

Warning (2): array_merge() [function.array-merge]: Argument #2 is not an array [CORE\Cake\Model\Datasource\DboSource.php, line 1524]

When running this:

public function pdf($the_id) {
    $searchs = $this->Order->find('all', array('conditions' => array('Order.id' => $the_id, 'Order.user_id' => $this->userDetails['id'])));
    if(empty($searchs)){
        $this->Session->setFlash('The requested order was not found or is not your order', 'error');
        $this->redirect(array('action' => 'yourorders'));
    }

    $this->set('orderpdf', $searchs);
}

Does anyone know why?

EDIT ---- Here is the model; it's a new model so it's quite small:

class Order extends AppModel {
    public $name = 'Order';
    public $belongsTo = array('User');
    public $hasOne = array('Basket', 'Sage');
}

Upvotes: 0

Views: 940

Answers (1)

Andrew Myers
Andrew Myers

Reputation: 461

$this->Order->unBindModel(array('hasOne' => array('Sage'))); worked. The Sage model doesn't have a table to refer to.

Upvotes: 1

Related Questions