Skip to content

feat/support multiple connections#125

Merged
SimonvanWijhe merged 16 commits into
mainfrom
feat/support-multiple-connections
Mar 12, 2026
Merged

feat/support multiple connections#125
SimonvanWijhe merged 16 commits into
mainfrom
feat/support-multiple-connections

Conversation

@SimonvanWijhe
Copy link
Copy Markdown
Member

@SimonvanWijhe SimonvanWijhe commented Mar 6, 2026

Fixes #119

TODO:

  • meerdere connecties ondersteunen
  • dubbele connecties samenvoegen
  • speciale tekens niet escapen
  • Mogelijkheid toevoegen om meerdere posts per connectie te selecteren

getest in participatie met config:

return [
	'connections' => [
		[
			'from' => 'owc-suggestion',
			'meta_key' => 'suggestion_project',
			'to' => 'owc-project',
		],
		[
			'from' => 'owc-map-suggestion',
			'meta_key' => 'map_suggestion_project',
			'to' => 'owc-project',
		],
		[
			'from' => 'owc-map-suggestion',
			'meta_key' => 'map_suggestion_suggestion',
			'to' => 'owc-suggestion',
		],
	],
];
Screen.Recording.2026-03-10.at.15.28.59.mov
  • dat sommige posts "geen titel" tonen is een issue in participatie

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

Coverage report for commit: bf1609f
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ███████████████████████ │ 42.9%
  10% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  20% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ████████░░░░░░░░░░░░░░░ │ 14.3%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ ████████░░░░░░░░░░░░░░░ │ 14.3%
 100% │ ████████████████░░░░░░░ │ 28.6%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 30.12% | Methods: 58.49%
FilesLinesMethodsBranches
src/Block
   Block.php--100.00%
   BlockAttributes.php92.54%93.55%100.00%
src/Casts
   IntCast.php50.00%-100.00%
src/Query
   PostQuery.php--100.00%
   QueryInterface.php100.00%100.00%100.00%
src
   QueryBlockServiceProvider.php--100.00%
src/Traits
   Helpers.php100.00%100.00%100.00%

🤖 comment via lucassabreu/comment-coverage-clover

@SimonvanWijhe SimonvanWijhe marked this pull request as draft March 6, 2026 12:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for filtering query results by multiple configured “connections” between post types (issue #119), extending the existing single-connection implementation.

Changes:

  • Update connection meta-key resolution to return multiple meta_key values per target post type.
  • Adjust the query-layer connection filter to use whereHas('meta', ...) with whereIn constraints.
  • Tighten enableConnection() to require connectionPosts to be non-empty.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/Query/PostQuery.php Reworks the connection filter from hasMeta(...) to a meta relationship subquery for multi-connection support.
src/Block/BlockAttributes.php Changes connection meta-key lookup to return multiple keys and alters how selected connection targets are represented.
Comments suppressed due to low confidence (1)

src/Block/BlockAttributes.php:88

  • The phpdoc for connectedPost() no longer matches what the method returns. It currently builds an array with meta_keys (array) and post_id (list), but the doc says array<string, int> and has an extra }. Updating the docblock (and ideally the return shape/type) will help static analysis and prevent misuse by callers.
	/**
	 * @return array<string, int>}
	 */
	public function connectedPost(): array
	{

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Block/BlockAttributes.php
Comment thread src/Query/PostQuery.php Outdated
Comment thread src/Block/BlockAttributes.php
Comment thread src/Block/BlockAttributes.php Outdated
Comment thread src/Block/BlockAttributes.php
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Block/BlockAttributes.php
Comment thread src/Block/BlockAttributes.php
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

@SimonvanWijhe I've opened a new pull request, #127, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Query/PostQuery.php Outdated
Comment thread src/Block/BlockAttributes.php
Comment thread assets/components/filters-controls/connection-control.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@SimonvanWijhe SimonvanWijhe marked this pull request as ready for review March 10, 2026 15:03
@SimonvanWijhe SimonvanWijhe requested a review from a team as a code owner March 10, 2026 15:03
handleChange={ onChange }
isClearable={ true }
isMulti={ false }
isMulti={ true }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deze moet nu toch weer op false? Want dat werkt toch niet?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ja dit werkt dus wel :)

Wat niet werkt is wanneer "Select Multiple" is aangevinkt:

Post-Object-General-Settings

Dan slaat acf alle post ID's als een serialized array op in de database.

Comment thread assets/utils/helpers.js Outdated
Comment on lines +39 to +45
/**
* Decodes HTML entities commonly found in post-titles and names
*
* @param {string} text - The text to decode
* @return {string} Decoded text
*/
export const decodeEntities = ( text = '' ) => {
Copy link
Copy Markdown
Contributor

@YvetteNikolov YvetteNikolov Mar 10, 2026

Choose a reason for hiding this comment

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

Er is hier een wordpress package voor https://developer.wordpress.org/block-editor/reference-guides/packages/packages-html-entities/

Je hoeft hem volgens mij niet te installen, staat op de wp global, dus on top of the file

 import { decodeEntities } from '@wordpress/html-entities';

doen

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Beter!

@SimonvanWijhe SimonvanWijhe merged commit eddb359 into main Mar 12, 2026
5 checks passed
@SimonvanWijhe SimonvanWijhe deleted the feat/support-multiple-connections branch March 12, 2026 09:05
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.

Bug: connection gaat niet goed als er twee

7 participants