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

Keep block cache settings on duplicate a block #10101

Merged
merged 3 commits into from Dec 7, 2021

Conversation

hissy
Copy link
Contributor

@hissy hissy commented Nov 23, 2021

Fix #9354

  • Avoid using raw sql query in Block::duplicate
  • Keep block cache settings on duplicate a block

$r = $db->prepare($q);
$res = $db->execute($r, $v);
$newBID = $db->Insert_ID(); // this is the latest inserted block ID
$connection->createQueryBuilder()
Copy link
Contributor

@mlocati mlocati Nov 23, 2021

Choose a reason for hiding this comment

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

I love the insert method much more ;)

It'd be

$connection->insert('Blocks', [
    'bName' => $this->getBlockName(),
    'bDateAdded' => $bDate,
    'bDateModified' => $bDate,
    'bFilename' => $this->getBlockFilename(),
    'btID' => $this->getBlockTypeID(),
    'uID' => $this->getBlockUserID(),
]);

which is much more readable

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I agree, I find these query. builder statements extremely difficult to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mlocati @aembler Changed to use $connection->insert()

@aembler aembler merged commit 9af4935 into concretecms:develop Dec 7, 2021
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.

Block cache override settings are reset.
3 participants