Skip to content

Conversation

tomasfejfar
Copy link
Contributor

Fixes #45

## 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.

Copy link
Member

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.

Copy link
Member

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

Copy link
Contributor Author

@tomasfejfar tomasfejfar Mar 15, 2019

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.

Copy link
Contributor Author

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í :)

Copy link
Contributor Author

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.

Copy link
Member

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í.

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ve zkratce:

  1. v index.php mám $myComponent->run()
  2. přejmenuju Component::run() na Component::runAction()
  3. 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.

Copy link
Member

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()

Copy link
Contributor Author

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.

@tomasfejfar tomasfejfar requested a review from odinuv March 18, 2019 08:21
@tomasfejfar tomasfejfar self-assigned this Mar 18, 2019
@tomasfejfar tomasfejfar merged commit 0db7466 into master Mar 18, 2019
@tomasfejfar tomasfejfar deleted the tf-sync-actions branch March 18, 2019 10:44
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

Successfully merging this pull request may close these issues.

2 participants