You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting this error when am querying sql model with mongo model relation existence
Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'exists ?) order by `modified_at` desc' at line 1 in /var/www/test/vendor/illuminate/database/Connection.php:333
Stack trace:
#0 /var/www/test/vendor/illuminate/database/Connection.php(333): PDO->prepare('select * from `...')#1 /var/www/test/vendor/illuminate/database/Connection.php(722): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), 'select * from `...', Array)#2 /var/www/test/vendor/illuminate/database/Connection.php(685): Illuminate\Database\Connection->runQueryCallback('select * from `...', Array, Object(Closure))#3 /var/www/test/vendor/illuminate/database/Connection.php(349): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))#4 /var/www/test/vendor/illuminate/database/Query/Builder.php(161 in
/var/www/test/vendor/illuminate/database/Connection.php on line 729
Sql Model
namespaceApp\Models\Sql;
useIlluminate\Database\Eloquent\Model;
useJenssegers\Mongodb\Eloquent\HybridRelations;
class History extends Model
{
use HybridRelations;
/** @var string Connection Name */protected$connection = 'default';
/** * History with Campagin Details * @return \Jenssegers\Mongodb\Relations\HasOne */publicfunctioncampaign()
{
return$this->hasOne('\App\Models\Mongo\Campaign', 'campaign.campaign_id', 'campaign_id');
}
}
This way am checking relation existence. If i remove has it works fine but using has throws the PDOException error
Uh oh!
There was an error while loading. Please reload this page.
Hi,
Getting this error when am querying sql model with mongo model relation existence
Sql Model
This way am checking relation existence. If i remove
has
it works fine but usinghas
throws thePDOException
errorand here is the sql query formed
The text was updated successfully, but these errors were encountered: