-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from harness-software/feature/473-update-wpgrap…
…hql-for-posts2posts-to-include-input-arguments-Natac-update feature/473 update wpgraphql for posts2posts to include input arguments Natac update
- Loading branch information
Showing
26 changed files
with
4,182 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
!.env.dist | ||
!tests | ||
.devcontainer.json | ||
.DS_Store | ||
.env | ||
.env.* | ||
.idea | ||
.log/ | ||
.vscode | ||
*.sql | ||
*.tar.gz | ||
.scannerwork | ||
*.zip | ||
build/ | ||
composer.lock | ||
coverage/* | ||
node_modules/ | ||
phpcs.xml | ||
phpunit.xml | ||
schema.graphql | ||
sonar-project.properties | ||
sonar-scanner | ||
tests/*.suite.yml | ||
Thumbs.db | ||
wp-cli.local.yml | ||
vendor/* | ||
!vendor/composer | ||
!vendor/composer/* | ||
!vendor/autoload.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
parameters: | ||
level: 8 | ||
inferPrivatePropertyTypeFromConstructor: true | ||
checkMissingIterableValueType: false | ||
featureToggles: | ||
disableRuntimeReflectionProvider: true | ||
bootstrapFiles: | ||
- wp-graphql-posts-to-posts.php | ||
paths: | ||
- wp-graphql-posts-to-posts.php | ||
- src/ | ||
scanDirectories: | ||
- ../wp-graphql/ | ||
- ../posts-to-posts/ | ||
ignoreErrors: | ||
- '#^Call to an undefined method object::disconnect\(\).$#' | ||
- '#^Call to an undefined method object::connect\(\).$#' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
=== WPGraphQL for Posts 2 Posts === | ||
Contributors: kellenmace, natac13, justlevine | ||
Tags: GraphQL, Gatsby, Headless, Posts2Posts | ||
Requires at least: 5.4.1 | ||
Tested up to: 5.8 | ||
Requires PHP: 7.4 | ||
Requires Posts To Posts: 1.6.6+ | ||
Requires WPGraphQL: 1.0.0+ | ||
Stable tag: 0.2.0 | ||
Maintained at: https://github.com/harness-software/wp-graphql-posts-to-posts | ||
License: GPL-3 | ||
License URI: https://www.gnu.org/licenses/gpl-3.0.html | ||
|
||
== Description == | ||
WordPress plugin that creates GraphQL connections for all of your [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/) connections. For more information, see [README.md](https://github.com/harness-software/wp-graphql-posts-to-posts/blob/master/README.md) | ||
|
||
== Upgrade Notice == | ||
== Frequently Asked Questions == | ||
== Screenshots == | ||
|
||
== Changelog == |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* Abstract Mutation class. | ||
*/ | ||
namespace WPGraphQLPostsToPosts\Mutations; | ||
|
||
use GraphQL\Error\UserError; | ||
use WPGraphQLPostsToPosts\Interfaces\Hookable; | ||
use WPGraphQLPostsToPosts\Traits\ObjectsTrait; | ||
|
||
abstract class AbstractMutation implements Hookable { | ||
use ObjectsTrait; | ||
|
||
public function register_hooks() : void { | ||
add_action( get_graphql_register_action(), [ $this, 'register_input_fields' ] ); | ||
} | ||
|
||
abstract public function register_input_fields() : void; | ||
|
||
/** | ||
* Register the P2P Connection | ||
* | ||
* @param integer $from_id | ||
* @param integer $to_id | ||
* @param string $connected_type | ||
* | ||
* @throws UserError No Posts2Posts connection for $connected_type. | ||
*/ | ||
public function connect_p2p_type( int $from_id, int $to_id, string $connected_type ) : void { | ||
$p2p_type = p2p_type( $connected_type ); | ||
|
||
if ( ! is_object( $p2p_type ) ) { | ||
throw new UserError( | ||
// translators: P2P connnection type name. | ||
sprintf( __( 'No Posts2Posts connection type found for %s', 'wp-graphql-posts-to-posts' ), $connected_type ) | ||
); | ||
} | ||
|
||
$p2p_type->connect( | ||
$from_id, | ||
$to_id, | ||
); | ||
} | ||
|
||
public function disconnect_p2p_type( int $from_id, int $to_id, string $connected_type ) : void { | ||
$p2p_type = p2p_type( $connected_type ); | ||
|
||
if ( ! is_object( $p2p_type ) ) { | ||
throw new UserError( | ||
// translators: P2P connnection type name. | ||
sprintf( __( 'No Posts2Posts connection type found for %s', 'wp-graphql-posts-to-posts' ), $connected_type ) | ||
); | ||
} | ||
|
||
$p2p_type->disconnect( | ||
$from_id, | ||
$to_id, | ||
); | ||
} | ||
} |
Oops, something went wrong.