Does CakePHP finderQuery work with SQL Server? Where would I debug that?

Have you checked that there is actually a model called RecyclateTypeConversion and that it exists with a filename according to the CakePHP conventions? I.e. is there a models/recyclate_type_conversion.php and in that file, is the name of the model defined as RecyclateTypeConversion.

The error that you're getting seems to hint that there's something wrong with that model name, as it cannot find the associated index.


Try removing the alias from the select - the casting in in the "AS RecyclateTypeConversion" part should handle that for you. I also like to wrap custom queries in double quotes. I might just be paranoid but string parsing errors have bit me in the ass before.

var $hasMany = array(
    'RecyclateTypeConversion' => array(
    'className' => 'RecyclateTypeConversion',
    'foreignKey' => 'recyclate_type_id',
    'dependent' => false,
    'finderQuery' => "select * from recyclate_type_conversions AS RecyclateTypeConversion WHERE RecyclateTypeConversion.recyclate_type_id IN ({$__cakeID__$});",
);

Also, I highly suggest you use the DebugKit plugin and post back to us the query log and a debug output of the find results that cause the errors.