-
Notifications
You must be signed in to change notification settings - Fork 1
Support for sync actions #56
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
Conversation
5ae1003
to
5fa4fa9
Compare
5fa4fa9
to
c829440
Compare
## Migration from version 6 to version 7 | ||
|
||
The default entrypoint of component (in `index.php`) changed from `BaseComponent::run()` to `BaseComponent::execute()`. While running the component via `run` method is still supported, you need to use `execute()` if you want to take advantage of sync action support. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to je zoufale nahovno bcbreak. run.php se testuje zpravidla jen integracnima testama a ty zase zpravidla netestujou sync akce. to znamena, ze kdyz updatnes komponentu a zapomenes ji zmenit run.php tak testy projdou, ale sync akce nebudou fungovat.
premyslim jak z toho vybruslit a nejjednodussi se mi zda, prejmenovat run
na runAction
, coz se me sice nelibi, protoze se pak trosku zbytecne bude plest se sync akcema, ale udela to poradnej bc break, kterej zajisti, ze se pokazenej run.php
nedostane do produkce.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taky bych do bc breaku pridal, ze testovaci konfigurace musi mit run, v testech to casto chybi, protoze to melo default hodnotu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taky bych do bc breaku pridal, ze testovaci konfigurace musi mit run, v testech to casto chybi, protoze to melo default hodnotu
Myšlenka byla, že když na tom teď závisíme (předtím jsme nikde v kódu run metodu nevyžadovali) tak bysme měli run vyžadovat.
Ale na druhou stranu si říkám, že by asi bylo lepší ten BC break udělat co nejmenší - aby to byl co nejmenší pain upgradovat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prejmenovat run na runAction
Což ale neudělá nic. MyComponent::run()
furt existuje a furt se volá z indexu. A nemusí volat parent::run(), takže ani kdybych tam dal exceptionu, tak to nepomůže.
Napadá mě v konstruktoru přes reflexi zkontrolovat, že run není public ale protected. Když bude protected, tak nejde zavolat z indexu a problem solved. A komponenty určitě parent constructor volají. Jinak by přišli o většinu cool věcí, co component umí :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zkusím to vykopnout a pushnout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no tak z teho komentara su jelen :)
A nemusí volat parent::run(),
A komponenty určitě parent constructor volají.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
z komentare jsem jelen, ale myslim, ze by to tak mohlo byt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ve zkratce:
- v
index.php
mám$myComponent->run()
- přejmenuju
Component::run()
naComponent::runAction()
MyComponent::run
se nepřejmenuje, takže volání v 1. stále proběhne jako by nic
Oproti tomu, když něco přidám do konstruktoru, tak tam je slušná jistota, že se to zavolá i v poděděné komponentě.
To jsem tím chtěl říct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MyComponent::run se nepřejmenuje, takže volání v 1. stále proběhne jako by nic
neprobehene, protoze neexistuje parent::run()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Což předpokládá, že v metodě mycomponent::run se zavolá parent::run. Což myslím, že se moc neděje.
e6a8df4
to
9c9a760
Compare
9c9a760
to
39ee018
Compare
Fixes #45