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

OHRM-941:Integrate Doctrine 2.6 for i18n related entities #10

Draft
wants to merge 2 commits into
base: 4.6
Choose a base branch
from

Conversation

RajithaKumara
Copy link
Owner

No description provided.

->leftJoin('t.I18NLangString ls')
->leftJoin('t.I18NLanguage l')
->andWhere('l.code = ?', $langCode);
$q = Doctrine2::getEntityManager()->getRepository(I18NTranslate::class)->createQueryBuilder('t');

Choose a reason for hiding this comment

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

This part may be abstract to DAO class .. something like $this->getQueryBuilder()

* @throws DaoException
*/
public function getLanguageByCode(string $langCode)
{
try {
return Doctrine::getTable('I18NLanguage')->findOneBy('code', $langCode);
return Doctrine2::getEntityManager()->getRepository(I18NLanguage::class)->findOneBy(['code' => $langCode]);

Choose a reason for hiding this comment

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

reuse $this->queryBuilder here


if (!empty($searchParams->getParameter('langCode'))) {
$q->andWhere('l.code = ?', $searchParams->getParameter('langCode'));
$q->andWhere('l.code = :langCode');

Choose a reason for hiding this comment

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

This is good, binding param with a name

* @throws DaoException
*/
public function getI18NSource(string $source)
{
try {
return Doctrine::getTable('I18NSource')->findOneBy('source', $source);
return Doctrine2::getEntityManager()->getRepository(I18NSource::class)->findOneBy(['source' => $source]);

Choose a reason for hiding this comment

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

what if use orangehrm/orm class that wraps doctrine stuff ?

@@ -272,7 +279,8 @@ public function saveI18NTranslate(I18NTranslate $i18NTranslate)
*/
public function saveI18NLanguage(I18NLanguage $i18NLanguage)
{
$i18NLanguage->save();
Doctrine2::getEntityManager()->persist($i18NLanguage);

Choose a reason for hiding this comment

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

Doctrine2 may replace oranghrm/orm:getEntityManager()

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.

None yet

2 participants