Hello,

I tried to do use associated models in my select conditions

[code]
$Orders = $this->Order->find('all',
                        array(
                                'conditions' =>
                                        array(
                                                'LIEFERANTENNR' => '70085',
                                                'STATUS <>' => '3',
                                                'BELEGART <>' => 'A',
                                                'OrderItem.STATUS' => '1'
                                        ),
                                'order' => 'OrderItem.LIEFERDATUM DESC'
                        )
                );
[/code]

the model looks like this

[code]

class Order extends AppModel {
        var $name = 'Order';
        var $tablePrefix = '';
        var $useTable = 'BESTELLKOPF';
        var $primaryKey = 'BELEGNR';

        var $hasMany = array(
                'OrderItem' => array(
                        'className' => 'OrderItem',
                        'foreignKey' => 'BELEGNR'
                )
        );
}

[/code]

By executing this request I get an SQL error that the associated model
can't be bind to the query:
SQL Error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Der
mehrteilige Bezeichner 'OrderItem.STATUS' konnte nicht gebunden
werden.
[Microsoft][SQL Server Native Client 10.0][SQL Server]Der mehrteilige
Bezeichner 'OrderItem.LIEFERDATUM' konnte nicht gebunden werden.

(sorry for the German errors, but it's a German server installation)

What I'm doing wrong?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to