Skip to content
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

[WIP] Feature/item persister and retriever #1112

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

discordier
Copy link
Member

Description

This feature extracts the database interfacing routines into separate classes.

This is currently work in progress.

Checklist

  • Read and understood the CONTRIBUTING guidelines
  • Created tests, if possible
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself to the @authors in touched PHP files
  • Checked the changes with phpcq and introduced no new issues

@discordier
Copy link
Member Author

we might want to cherry-pick 2798cd6 here.

@zonky2 zonky2 added the enhancement This issue is about an enhancement (aka new feature) label Apr 19, 2017
@zonky2 zonky2 added this to the 2.0.0 milestone Apr 19, 2017
@zonky2
Copy link
Contributor

zonky2 commented Apr 19, 2017

@zonky2
Copy link
Contributor

zonky2 commented Apr 19, 2017

test for #1005 with translated_text: the empty "zomby cells" live on

@discordier in my opinion, we should implement the check to empty values at

public function setTranslatedDataFor($arrValues, $strLangCode)
{
$objDB = $this->getMetaModel()->getServiceContainer()->getDatabase();
// First off determine those to be updated and those to be inserted.
$arrIds = array_keys($arrValues);
$arrExisting = array_keys($this->getTranslatedDataFor($arrIds, $strLangCode));
$arrNewIds = array_diff($arrIds, $arrExisting);
// Update existing values.
$strQuery = 'UPDATE ' . $this->getValueTable() . ' %s';
foreach ($arrExisting as $intId) {
$arrWhere = $this->getWhere($intId, $strLangCode);
$objDB->prepare($strQuery . ($arrWhere ? ' WHERE ' . $arrWhere['procedure'] : ''))
->set($this->getSetValues($arrValues[$intId], $intId, $strLangCode))
->execute(($arrWhere ? $arrWhere['params'] : null));
}
// Insert the new values.
$strQuery = 'INSERT INTO ' . $this->getValueTable() . ' %s';
foreach ($arrNewIds as $intId) {
$objDB->prepare($strQuery)
->set($this->getSetValues($arrValues[$intId], $intId, $strLangCode))
->execute();
}
}

we can use two strategies:

@zonky2 zonky2 added the Up for discussion This ticket will be up for discussion in one of our next calls label Apr 23, 2017
@zonky2
Copy link
Contributor

zonky2 commented Apr 24, 2017

=> "check the value and delete"

@zonky2 zonky2 removed the Up for discussion This ticket will be up for discussion in one of our next calls label Apr 24, 2017
@stefanheimes stefanheimes changed the base branch from hotfix/alpha-15 to hotfix/alpha-16 May 22, 2017 22:11
@stefanheimes stefanheimes reopened this May 22, 2017
@stefanheimes stefanheimes changed the base branch from hotfix/alpha-16 to hotfix/2.0.0-alpha16 May 22, 2017 22:46
@stefanheimes stefanheimes reopened this May 22, 2017
@discordier discordier force-pushed the feature/item-persister-and-retriever branch from f21ba95 to def1cc7 Compare May 30, 2017 20:43
@dmolineus dmolineus closed this Sep 11, 2017
@richardhj
Copy link
Member

Change base branch and reopen?

@discordier discordier changed the base branch from hotfix/2.0.0-alpha16 to hotfix/2.0.0-alpha17 September 18, 2017 11:27
@discordier discordier reopened this Sep 18, 2017
@discordier
Copy link
Member Author

Something else to do here, we should inject the persister, retriever and resolver via constructor injection.
That way the MetaModel will become more independent and we could swap either component by another one (using doctrine connection i.e.) in the future.

@discordier discordier closed this Feb 6, 2018
@zonky2
Copy link
Contributor

zonky2 commented Feb 6, 2018

Why closed?

@discordier discordier changed the base branch from hotfix/2.0.0-alpha17 to hotfix/2.0.0-alpha18 February 7, 2018 10:23
@discordier discordier reopened this Feb 7, 2018
@discordier
Copy link
Member Author

I deleted the alpha17 branch and github closed the PR then. :/

@zonky2
Copy link
Contributor

zonky2 commented Feb 7, 2018

o.k.

@discordier discordier force-pushed the feature/item-persister-and-retriever branch from def1cc7 to cf3a346 Compare March 6, 2018 12:25
@zonky2 zonky2 removed this from the 2.0.0 milestone Mar 9, 2018
@zonky2 zonky2 added this to the 2.1.0 milestone Mar 9, 2018
@discordier discordier closed this Mar 10, 2018
@discordier discordier changed the base branch from hotfix/2.0.0-alpha18 to master March 10, 2018 00:22
@discordier discordier reopened this Mar 10, 2018
@discordier discordier force-pushed the feature/item-persister-and-retriever branch from cf3a346 to 8e06889 Compare March 10, 2018 00:30
In addition we also now have an IdResolver
We also have hybrid attributes (like select) which are both, ISimple and
IComplex. We might also have all other kinds of combinations.
Therefore we now have the sequence of:
- Always fetch simple attributes
- Then try translated
- Finally try complex
@discordier discordier force-pushed the feature/item-persister-and-retriever branch from 8e06889 to d329d9d Compare March 10, 2018 00:40
@zonky2 zonky2 modified the milestones: 2.1.0, 2.2.0 Mar 14, 2018
@zonky2 zonky2 modified the milestones: 2.2.0, 2.3.0 May 11, 2022
@zonky2 zonky2 modified the milestones: 2.3.0, 2.4.0 Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is about an enhancement (aka new feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants