-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date Columns Auto-Inclusion Issue in EloquentSalesForce 2.15 - 'No Such Column 'CreatedDate' on Entity #103
Comments
Temporary Solution: I've created a scope, either locally or globally, that excludes the Another issue I encountered involves the Please note that this is a temporary solution and might require a more robust approach in the future. Comments and suggestions are welcome. Pending a package fix. /**
* Exclude specified columns from the query.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param array $value
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeExclude($query, array $value): Builder
{
return $query->select(array_diff($this->columns, $value));
} |
Same problem here when using relations with eloquent.
|
My temporary fix for this issue is to add |
Issue FixProblem:The issue was related to the automatic inclusion of default columns ( Fix:I have addressed this issue locally by modifying the /**
* {@inheritDoc}
* file: Lester\EloquentSalesForce\Database\SOQLBuilder
*/
public function getModels($columns = ['*'])
{
// If the model has explicitly defined columns and '*' is requested
if (count($this->model->columns) && in_array('*', $columns)) {
// Use the explicitly defined columns from the model
$cols = $this->model->columns;
} else {
/**
* If there are no explicitly defined columns in the model,
* retrieve columns from the Salesforce service, including default ones ['Id', 'CreatedDate', 'LastModifiedDate', 'IsDeleted']
*/
$cols = $this->getSalesForceColumns($columns);
}
return parent::getModels($cols);
}
Note:
As I am not a contributor, I am unable to provide a pull request. However, this fix addresses the issue locally, and I hope it helps in resolving the problem. |
Description:
I have encountered an issue related to the handling of date columns in the latest version of the EloquentSalesForce package. After updating to
version 2.15.3
, I noticed that the base Salesforce model (Lester\EloquentSalesForce\Model
) automatically includes 'CreatedDate' and 'LastModifiedDate' columns in the$dates
property. However, in my Salesforce instance, these columns are not always present in every entity, leading to errors.Issue:
$dates
property in the base Salesforce model includes 'CreatedDate' and 'LastModifiedDate,' causing issues when these columns are not present in Salesforce entities.Expected Behavior:
$dates
property in my extended models, especially when these columns are not present in Salesforce entities.Reproduction Steps:
$dates
property, causing issues when these columns are not present in Salesforce entities.Version: 10
Version: 2.15.3
Error Message:
The text was updated successfully, but these errors were encountered: