Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/347012 )
Change subject: Rename constraint statement GUID to constraint ID ...................................................................... Rename constraint statement GUID to constraint ID Constraints aren’t currently read from statements, and in the future we’ll probably have other kinds of constraints as well, so let’s just generically call them IDs. Change-Id: Ice6a9e086786a725b97b6a3681784f6925261ca7 --- M includes/Constraint.php M includes/ConstraintRepository.php M maintenance/UpdateConstraintsTable.php M tests/phpunit/ConstraintTest.php 4 files changed, 10 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/12/347012/1 diff --git a/includes/Constraint.php b/includes/Constraint.php index e8f8f29..c0c1334 100644 --- a/includes/Constraint.php +++ b/includes/Constraint.php @@ -14,7 +14,7 @@ /** * @var string */ - private $constraintStatementGuid; + private $constraintId; /** * @var PropertyId @@ -37,18 +37,18 @@ private $constraintParameters; /** - * @param string $constraintStatementGuid + * @param string $constraintId * @param PropertyId $propertyId * @param string $constraintTypeQid * @param array $constraintParameters */ public function __construct( - $constraintStatementGuid, + $constraintId, PropertyId $propertyId, $constraintTypeQid, array $constraintParameters ) { - $this->constraintStatementGuid = $constraintStatementGuid; + $this->constraintId = $constraintId; $this->propertyId = $propertyId; $this->constraintTypeQid = $constraintTypeQid; $this->constraintParameters = $constraintParameters; @@ -57,8 +57,8 @@ /** * @return string */ - public function getConstraintStatementGuid() { - return $this->constraintStatementGuid; + public function getConstraintId() { + return $this->constraintId; } /** diff --git a/includes/ConstraintRepository.php b/includes/ConstraintRepository.php index 04b3537..dc39e52 100644 --- a/includes/ConstraintRepository.php +++ b/includes/ConstraintRepository.php @@ -41,7 +41,7 @@ $accumulator = array_map( function ( Constraint $constraint ) { return array( - 'constraint_guid' => $constraint->getConstraintStatementGuid(), + 'constraint_guid' => $constraint->getConstraintId(), 'pid' => $constraint->getPropertyId()->getNumericId(), 'constraint_type_qid' => $constraint->getConstraintTypeQid(), 'constraint_parameters' => json_encode( $constraint->getConstraintParameters() ) diff --git a/maintenance/UpdateConstraintsTable.php b/maintenance/UpdateConstraintsTable.php index 97a0f6b..0c350fe 100644 --- a/maintenance/UpdateConstraintsTable.php +++ b/maintenance/UpdateConstraintsTable.php @@ -74,11 +74,11 @@ } } - list( $statementGuid, $numericPropertyId, $constraintTypeQid, $params ) = $data; + list( $constraintId, $numericPropertyId, $constraintTypeQid, $params ) = $data; $constraintParameters = (array) json_decode( $params ); $accumulator[] = new Constraint( - $statementGuid, + $constraintId, PropertyId::newFromNumber( $numericPropertyId ), $constraintTypeQid, $constraintParameters diff --git a/tests/phpunit/ConstraintTest.php b/tests/phpunit/ConstraintTest.php index 4eef159..44540b1 100644 --- a/tests/phpunit/ConstraintTest.php +++ b/tests/phpunit/ConstraintTest.php @@ -23,7 +23,7 @@ $this->assertEquals( 'Item', $constraints[0]->getConstraintTypeQid() ); $this->assertEquals( new PropertyId( 'P1' ), $constraints[0]->getPropertyId() ); - $this->assertEquals( '1', $constraints[0]->getConstraintStatementGuid() ); + $this->assertEquals( '1', $constraints[0]->getConstraintId() ); $constraintParameters = $constraints[0]->getConstraintParameters(); $this->assertEquals( 2, count( $constraintParameters ) ); $this->assertEquals( 'P21', $constraintParameters['property'] ); -- To view, visit https://gerrit.wikimedia.org/r/347012 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice6a9e086786a725b97b6a3681784f6925261ca7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) <lucas.werkmeis...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits