Said that i have Model_Post that had relation in Model_User. When we do
$query = Model_Post::find() ;
$query->where($field, 'like','%search%' ) ;
we might have error if we do something look alike
$query->where('LEFT(FROM_UNIXTIME(`t0`.`created_at`),10)', 'like','%search%' ) ;
in the where function. The solution is to use the expr() function inside the where and place those 1st argument onto
the expr() function. so it will be.
$query->where(DB::expr('LEFT(FROM_UNIXTIME(`t0`.`created_at`),10)' ), 'LIKE',"%{search}%" ) ;