protected function RelationTestBase::saveRelation in Relation 8.2
Same name and namespace in other branches
- 8 src/Tests/RelationTestBase.php \Drupal\relation\Tests\RelationTestBase::saveRelation()
Saves a relation.
Parameters
string $relation_type: Machine name of the relation type.
array $endpoints: An array containing the endpoints.
Return value
string|int|null
4 calls to RelationTestBase::saveRelation()
- RelationTestBase::createRelationDirectional in src/
Tests/ RelationTestBase.php - Creates a Directional relation.
- RelationTestBase::createRelationOctopus in src/
Tests/ RelationTestBase.php - Creates an Octopus (4-ary) relation.
- RelationTestBase::createRelationSymmetric in src/
Tests/ RelationTestBase.php - Creates a Symmetric relation.
- RelationTestBase::createRelationUnary in src/
Tests/ RelationTestBase.php - Creates an Unary relation.
File
- src/
Tests/ RelationTestBase.php, line 255
Class
- RelationTestBase
- Provides common helper methods for Taxonomy module tests.
Namespace
Drupal\relation\TestsCode
protected function saveRelation($relation_type, array $endpoints) {
$relation = Relation::create(array(
'relation_type' => $relation_type,
));
$relation->endpoints = $endpoints;
$relation
->save();
if ($this->sleep) {
sleep(1);
}
return $relation
->id();
}