in the search function i have this piece of code
foreach($words as $word) {
$search = '%'.$word.'%';
$query['conditions'][]['or'] = array(
'ProductComponent.codice LIKE' => $search,
'ProductComponent.nome'.__('_it', true).' LIKE' => $search,
'ComponentType.nome'.__('_it', true).' LIKE' => $search,
'Material.nome'.__('_it', true).' LIKE' => $search,
'Finish.nome'.__('_it', true).' LIKE' => $search,
'ClientCode.client_component_code LIKE' => $search,
);
}
and when i execute the query i have this error
Warning (512): SQL Error: 1054: Unknown column 'ClientCode.client_component_code' in 'where clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]
this is the table
CREATE TABLE IF NOT EXISTS `client_codes` (
`id` int(10) NOT NULL auto_increment,
`user_id` int(10) NOT NULL,
`product_component_id` int(10) NOT NULL,
`client_component_code` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=225 ;
this is the ClientCode model
<?php
class ClientCode extends AppModel {
var $name = 'ClientCode';
var $belongsTo = array('ProductComponent', 'User');
}
?>
and these are the relations of the ProductComponent model
<?php
class ProductComponent extends AppModel {
var $name = 'ProductComponent';
var $belongsTo = array('ComponentType', 'Material', 'Finish','Line');
var $hasMany = array(
'Part',
'RelatedComponent',
'LineRelatedComponent' => array(
'className' => 'RelatedComponent',
'conditions' => array('NOT' => array('LineRelatedComponent.line_id' => NULL)),
),
'GenericRelatedComponent' => array(
'className' => 'RelatedComponent',
'conditions' => array('GenericRelatedComponent.line_id' => NULL),
),
'CustomPriceList',
'PriceList',
'ClientCode'
);
var $hasAndBelongsToMany = array('Upload');
I don't understand why...PLEASE HELP. Thanks!
ClientCode.client_component_code
column in your database? – Marek Seberaedit
under it – Marek Sebera