last day (14 days later) » 

9:58 AM
0
Q: How to implement events management system in Yii2 where it finds where to trigger dynamically added events?

Sanzhar DanI'm working on automation of events management for my web app. My goal is to prodive admins with function of adding new events to any model. The thing is, the whole process must be without addition of any code by admins. Logic must be injected into the app. While I do understand how to add eve...

 
@scaisEdge common man, it's not too broad, I'm asking if someone has ever experienced the same problem and thus has found solution. By the way I did read the official docs!
 
There are many ways to solve that kind of problems, like cronjobs, message queues and any other (could be complete custom) solutions. And there are definitely many extensions that provide that functionality for Yii. If you want to get some help, try to be more specific.
 
@Bfcm here's the problem: say I have blog completely build on Yii2. It's role based and has 3 roles - admins, moderators and readers. Customer wants admins to be able to add new push and browser notifications whenever they want it. The key point here is that developer can not foresee what kind of notificatoin an admin can add, as new notification may require new if statements and any other operation. For example: admin wants to get push notifications whenever article's title contains word "yii2". This implies adding new if statement to check if article's title equals to "yii2".
@Bfcm I think that it's not possible to completely automate that process. As it's not possible to forsee where admin would want to have new notification. While I do know how to add new notifications to the database and start listening to them, which is possible as you know in advance what models are used in particular controller's method, I'm making conclusion that it's not possible for Yii2 as well as for any PHP framework and even all other languages to place triggers automatically in the right place.
 
That is the key problem of software development - it is sometimes much easier to implement part of software logic (or call it business logic) to provide some functionality, than provide software, where business logic can be extended by non-programming people. In your case you have to define that logic should be understood by the software, that "admins" can define an build kind of interpreter for that.
 
@ The bottom line is - progammer himself should add trigger methods and customer's desire could not be fulfilled.
 
9:58 AM
And about PHP and Yii - there absolutely no difference that technology you use for that. Definitely it could be php and yii.
 
@Bfcm I guess this is where software development is moving to with the help of AI and machine learning.
 
The discussion is moving out of topic
 
Yes, that right. But got quite interesting
 
Anyway with your specific problem you could extend Yii behavior functionality that will give you what you want.
 
Thanks man for your attention and time
 
10:01 AM
Think about intergration between behavior functionality and database or message queue or both
Like extended behavior looks into db
and db will be fullfilled by message queue
 
Yes, I've already automated as many processes as possible for my project. The only thing that is not automated is adding trigger functions where they needed
 
We have similar technology to fulfill our Changelog functionality
it stores in db the model
like "Student"
and what actions were made
you could make similar thing to behavior
or it is also reminds me of implementing spam filter
 
you see, there's 1 directional process in your case. Which is saving actions from USER to database.
I already use behavior functionality and grab all notifications form the DB.
 
no, it is not user based, but model based
when anything changed to the model - we store that
 
Knowing what models are used in controller's particular method I easily know what events start listening to.
 
10:06 AM
So the problem is that you don't know what models are you using or what
?
 
So for each model your "watch" method that is triggered whenever something is done?
 
Yes
Not for each model, but for specific models.
It could also be each model
 
Let's look at your example to make it easier to understand.
Because what I want to do maybe applied to you
Say someone told you that your system should log separate message whenever user clicks exactly twice on some button
 
That is the behaivour
>>> Say someone told you that your system should log separate message whenever user clicks exactly twice on some button

okey, that is not problem
 
How are you going to add it automatically?
 
10:11 AM
As i said, you have to extend behavior logic for your needs
 
You see, in some cases adding new log or notification may require having new behavior, such as afterDoubleClick()
Ok, but extention will be done by the programmer, right?
 
Yes, you have to pre-define all behaviors your admins can add
Like you have pool of behaviors and admins can choose
 
GREAT! That's what I came up to =)
 
so that is the problem?
 
I should have told it before but forgot for some reason
No it's poor solution of the problem.
Because it implies having programmer to add new behaviors
 
10:15 AM
As i said, the business logic should predefine all possible behaviors
 
You're 100% right
 
and then non-programmer can add this whenever they whan
There is not much behaviors at all, if you see
maybe hundred or so
 
My customer wanted admins to add new notifications and behaviors on the fly and make them work withour any programmer.
I agree with you
 
I see no problem to predefine it
 
This is what I'd told him and what his team is doing now. But still I was wondering if there are some cutting-edge solutions that I've missed
 
10:17 AM
So there will be no need for programmer after all
There could be possible extensions for that, but I'm not sure
or the team of you customer could pack their solution as extension to contribute in open-source :)
gtg now
good day and have fun
 
You see, sometimes companies that don't have too much money hire IT agencies that make website or whatever they want for them. In 1 year or more, this IT agencies may go bankrupt or dissapear and this company won't have anyone who will help with their website. For that reason they want enclose them from programmers and have fully autonomus website.
LOL
thanks for your time, man! Have a good day and fun as well!
 

last day (14 days later) »