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
when query a model with whereDoesntHave on self relationship generete the following error
Error Code : 904 Error Message : ORA-00904: "CE_LARAVEL_RESERVED_0"."ID": invalid identifier Position : 103 Statement : select * from "CE_CATEGORIES" where not exists (select * from "CE_CATEGORIES" laravel_reserved_0 where "CE_LARAVEL_RESERVED_0"."ID" = "CE_CATEGORIES"."PARENT_CATEGORY")
For now i fix the problem by editing the following function wrapTable
inside src/Oci8/Query/Grammars/OracleGrammar.php
for use the prefix when concatenate $segments[0] with $segments[1]
publicfunctionwrapTable($table)
{
if ($this->isExpression($table)) {
return$this->getValue($table);
}
if (strpos(strtolower($table), ' as ') !== false) {
$table = str_replace(' as ', '', strtolower($table));
}
$tableName = $this->wrap($this->tablePrefix.$table, true);
$segments = explode('', $table);
if (count($segments) > 1) {
$tableName = $this->wrap($this->tablePrefix.$segments[0]).''.$this->tablePrefix.$segments[1];
}
return$this->getSchemaPrefix().$tableName;
}
Below an example code
Set the .env variable DB_PREFIX
Model
<?phpnamespaceApp\Models\Category;
useIlluminate\Database\Eloquent\Factories\HasFactory;
useIlluminate\Database\Eloquent\Model;
useIlluminate\Database\Eloquent\Relations\BelongsTo;
class Category extends Model
{
use HasFactory;
/** * @return BelongsTo<Category> */publicfunctionparent(): BelongsTo
{
return$this->belongsTo(Category::class, 'parent_category');
}
}
Hi
when query a model with whereDoesntHave on self relationship generete the following error
For now i fix the problem by editing the following function wrapTable
inside src/Oci8/Query/Grammars/OracleGrammar.php
for use the prefix when concatenate $segments[0] with $segments[1]
Below an example code
Set the .env variable DB_PREFIX
Model
Controller
The text was updated successfully, but these errors were encountered: