Skip to content
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

Could we implement addBehavior()? #83

Closed
damianoporta opened this issue Feb 5, 2016 · 7 comments
Closed

Could we implement addBehavior()? #83

damianoporta opened this issue Feb 5, 2016 · 7 comments

Comments

@damianoporta
Copy link
Contributor

Hello,
it seems that we cannot attach behavior to a type, is this an issue or does it has not been implemented yet?

@damianoporta
Copy link
Contributor Author

if we can not use behaviors now, is there any workaround?

@markstory
Copy link
Member

Behaviors are a bit tricky. While we could add them, I have concerns that many core and userland behaviors don't make sense in elastic search. For example TreeBehavior, TranslateBehavior make no sense and really have no way of properly functioning.

@damianoporta
Copy link
Contributor Author

@markstory you are right, but in this case there are other plugins like file-upload that need before/after save logic. With no behaviors we must create custom listeners somewhere and add callbacks for Model.before/afterSave

I tried to see how behaviorRegistry works, it accepts a Table object on its constructor, if we will implement behaviors...should we modify it or create another one "registry" ?

Thanks!

@damianoporta
Copy link
Contributor Author

@markstory for example the FriendsOfCake/Search plugin too.

@lorenzo
Copy link
Member

lorenzo commented Feb 5, 2016

I don't think it is a good idea. At least using "behaviors" as a word is not a good idea. We could perhaps duplicate the concept with a different name.

@github-actions
Copy link

github-actions bot commented Jan 8, 2020

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

@github-actions github-actions bot added the stale label Jan 8, 2020
@PhantomWatson
Copy link

My current use case that seems to call for a behavior is that I have a SQL table and an Elasticsearch index that represent data with the same fields, and I'd like to have them share custom finder methods. I don't think that this can be accomplished well with traits or class inheritance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants