Skip to content

[ticket/13487] Add factory for db tool class#3275

Merged
marc1706 merged 1 commit intophpbb:developfrom
nickvergessen:ticket/13487
Jan 22, 2015
Merged

[ticket/13487] Add factory for db tool class#3275
marc1706 merged 1 commit intophpbb:developfrom
nickvergessen:ticket/13487

Conversation

@nickvergessen
Copy link
Copy Markdown
Contributor

This allows us to split up the large file one by one easily.

https://tracker.phpbb.com/browse/PHPBB3-13487

@nickvergessen nickvergessen added this to the 3.2.0 milestone Jan 10, 2015
This allows us to split up the large file one by one easily.

PHPBB3-13487
@Nicofuma
Copy link
Copy Markdown
Member

Actually here we have 2 ways to that on an "easier" (using the DIC to construct the real db tools object):
For both of them we have to define a private service per db tools type (ie per database) and then we can:

  1. Using a factory and pass the container to it so instead of calling new we call $container->get('dbal.tools.')
  2. We can use a compiler pass to rename the real service or to create an alias.

I think I prefer the second solution (and by the way it could be nice to do the same think with the dbal driver)

@nickvergessen
Copy link
Copy Markdown
Contributor Author

Well im going to add an array implementation which is independent from the used db, does this still work (i don't know anything about compilerpass stuff)

@Nicofuma
Copy link
Copy Markdown
Member

When will this implementation be used and when will be the dbal driver dependent implementation?

@nickvergessen
Copy link
Copy Markdown
Contributor Author

It will be used for generating the schema.json and for tests,
the dbal driver version is used in code and the migrator

@Nicofuma
Copy link
Copy Markdown
Member

I think that the array implementation should be an independent public service and requested directly when needed.

@nickvergessen
Copy link
Copy Markdown
Contributor Author

Can we still ahve this little factory while we are splitting up the current db_tools file since it makes it a lot easier?

@Nicofuma
Copy link
Copy Markdown
Member

I think yes but if you do that this way you have to instantiate the class manually in the factory...

marc1706 added a commit to marc1706/phpbb that referenced this pull request Jan 22, 2015
[ticket/13487] Add factory for db tool class
@marc1706 marc1706 merged commit 11b6bc5 into phpbb:develop Jan 22, 2015
@nickvergessen nickvergessen deleted the ticket/13487 branch January 22, 2015 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants