catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

Medoo::RAW with joined table under Version 2.x.x #995

Open rotkaepchen opened 3 years ago

rotkaepchen commented 3 years ago

Hi all,

I have an issue to join tables and use Medoo::RAW as where. Database: Postgresql

Example: $join=array('[>]AdminSegmentTypes'=>['segment_types_id'=>'id']); $where="WHERE network.networkv4 <<= INET'$net' OR network.networkv6 <<= INET'$net'"; $result=$database->select($table,$join,$fields,Medoo2::raw($where) );

Error: Uncaught TypeError: Argument 5 passed to medoo2\Medoo2::selectContext() must be of the type array or null, object given, called in classes/medoo2/Medoo2.class.php on line 1593 and defined in classes/medoo2/Medoo2.class.php:1163 Stack trace: #0 classes/medoo2/Medoo2.class.php(1593): medoo2\Medoo2->selectContext('adminnetworksco...', Array, Array, Array, Object(medoo2\Raw)) #1 content/netmgmt/find_networks.php(88): medoo2\Medoo2->select('network...', Array, Array, Object(medoo2\Raw)) #2 {main} thrown in classes/medoo2/Medoo2.class.php on line 1163

If I use version 1.7.10 with the same command then it works.

regards

m-nienberg commented 3 years ago

I came here to report this issue, but found this already here, so I'll just add that I have the same problem. Thanks,

fran-diaz commented 3 years ago

@catfan Seems that deleting "array" at line 1168 fixes the problem.