Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Question: Why initialize and not startup? #138

Closed
vincent-fletcher opened this issue May 9, 2014 · 3 comments
Closed

Question: Why initialize and not startup? #138

vincent-fletcher opened this issue May 9, 2014 · 3 comments
Labels

Comments

@vincent-fletcher
Copy link

I have run into some issues using this plugin with a multi-tenant database structure (isolated databases), because the initialize() function in PrgComponent constructs models before my authentication code has had a chance to figure out which tenant database to use.

I have renamed initialize() function to startup() (so it is executed after my Auth has had a chance to login the user), and everything still seems to be working correctly - but I am wondering whether there is some kind of issue with this beneath the surface that I have not uncovered?

Any info would be much appreciated.

@burzum
Copy link
Contributor

burzum commented May 11, 2014

Should be OK to change it to startup(), I'll investigate it a little more and talk to the team before we make a change we might regret in some use case we don't consider right now.

@dereuromark
Copy link
Contributor

I can also not see a reason why it shouldn't work. But looking into it more detailed before doing that sure helps to avoid regressions or future issues. Some use cases might involve other components or the action itself to hook into it which then wouldn't necessarily happen any more in the expected order.

@burzum
Copy link
Contributor

burzum commented May 12, 2014

I've made this configurable to preserve backward compatibility. Just configure the component to use startup:

public $components = array(
    'Prg' => array('callback' => 'startup')
);

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

No branches or pull requests

3 participants