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

Nette/Object with Kdyby/Events #106

Closed
simPod opened this issue Dec 3, 2016 · 6 comments
Closed

Nette/Object with Kdyby/Events #106

simPod opened this issue Dec 3, 2016 · 6 comments

Comments

@simPod
Copy link

simPod commented Dec 3, 2016

I somehow noticed nette is getting rid of Nette/Object. So I started to use SmartObject trait with this library instead. But is it good approach? It' weird to me that I use SmartObject just to be able to use this library...

@enumag
Copy link
Member

enumag commented Dec 8, 2016

I don't think you need SmartObject. Kdyby/Events identifies the properties by their "on" prefix (I think). You don't need smart object for that. The only thing you'll need is a helper function to invoke all functions in the array because you can no longer use $this->onEvent($arg);.

@TomasVotruba
Copy link

@simPod Do you still need help?

@simPod
Copy link
Author

simPod commented Dec 24, 2016

No, I'm good, thanks everyone!

I also realised I'd rather use eventmanager to dispatch events.

@TomasVotruba
Copy link

@simPod Great. How does it look like in full-code version?

If really solved, please close the issue.

@simPod simPod closed this as completed Dec 26, 2016
@simPod
Copy link
Author

simPod commented Dec 26, 2016

Most of the events I try to dispatch using

$this->evm->dispatchEvent(
	Event::SOMENAME,
	new EventArgsList(...$args)
);

@TomasVotruba
Copy link

TomasVotruba commented Dec 26, 2016

@simPod Great! :) That's the best way I could think of.

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

No branches or pull requests

3 participants