-
Notifications
You must be signed in to change notification settings - Fork 340
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
Sync conditional models #264
Conversation
I really don’t think this behavior is desired in many cases. The Think about a scenario where you want to sync your model but “freeze” its state with the service provider. So you go and add a “frozen” column to your models and the If we decide go down that path, we need to fix the import artisan command to unsync models as-well. |
I've initially created this PR as #263 but Taylor replied this should be default behaviour in his opinion and I agree on that. I get your example but wouldn't using the public static function syncingDisabledFor($class)
{
if (is_object($class) && $class->isSyncingDisabled()) {
return true;
}
$class = is_object($class) ? get_class($class) : $class;
return isset(static::$syncingDisabledFor[$class]);
} I don't think that we would have to fix the import command since that command should import the models and not sync them. Adding a sync command or passing a |
The Yea, passing a @taylorotwell maybe we need to re-consider PR #263 and also add an optional |
@kfirba that wasn't what |
@taylorotwell well, That being said, how would you go about syncing your models with a service provider and keep them in a specific state while your local model may change a little bit? I really think that exposing an additional configuration option is the best solution here. Why are you so reluctant to that? |
No, the library (or, really I the maintainer) decides what the method means. It's not up for interpretation. It means, the model should be searchable or not. The whole debate about freezing the search state while your local model changes is something for an entirely new feature discussion and doesn't belong here. It's only confusing the current discussion. |
As mentioned in #263 the models where
shouldBeSearchable()
returnsfalse
are not deleted from the search engine.This PR makes sure those models are made unsearchable to prevent your search engine exposing data that shouldn't be available.
This PR fixes #249