Skip to content

Conversation

ChristophWurst
Copy link
Member

Fixes #960.

Required for #959.

This migration is mandatory as the old mappers are deprecated now.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst added this to the 0.10.0 milestone Aug 16, 2018
@ChristophWurst ChristophWurst self-assigned this Aug 16, 2018
@ChristophWurst ChristophWurst changed the title Migrate to query builder mapper Migrate to query builder mappers Aug 16, 2018
@ChristophWurst
Copy link
Member Author

ChristophWurst commented Aug 16, 2018

Scrutinizer — 4 new issues

->from($this->getTableName())
->where(
$qb->expr()->eq('user_id', $qb->createNamedParameter($userId)),
$qb->expr()->orX(
Copy link
Member

Choose a reason for hiding this comment

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

Below you do andWhere on the sexond expression. Might make sense to do it consitently one way. (I prefer the andWhere since it makes it explicit it is an AND

Copy link
Member

Choose a reason for hiding this comment

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

To be clear I mean

->where(
  <1>,
  <2>);

vs

->where(<1>)
->andWhere(<2>);

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, yes. Fixed.

->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)))
->andWhere($qb->expr()->eq('email', $qb->createNamedParameter($email)));
Copy link
Member

Choose a reason for hiding this comment

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

The original expersssion does an ILIKE.. this is pure equal. intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not intentional, but rather a copy-paste error :P

$query = $qb
->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
Copy link
Member

Choose a reason for hiding this comment

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

The oroginal statement has id = ? this one not. Intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, my fault.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst merged commit 1ecf67c into master Aug 17, 2018
@ChristophWurst ChristophWurst deleted the refactor/query-builder-mapper branch August 17, 2018 06:47
@lock
Copy link

lock bot commented Nov 20, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and questions.

@lock lock bot locked and limited conversation to collaborators Nov 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants