Skip to content

Commit 762c396

Browse files
committed
Merge pull request parse-community#175 from ParsePlatform/gfosco.getRelation
Added param to getRelation for Issue 126
2 parents f277262 + 5944e96 commit 762c396

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Parse/ParseObject.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,15 +1171,16 @@ private function mergeAfterSave($result)
11711171
/**
11721172
* Access or create a Relation value for a key.
11731173
*
1174-
* @param string $key The key to access the relation for.
1174+
* @param string $key The key to access the relation for.
1175+
* @param string $className The target class name.
11751176
*
11761177
* @return ParseRelation The ParseRelation object if the relation already
11771178
* exists for the key or can be created for this key.
11781179
*/
1179-
public function getRelation($key)
1180+
public function getRelation($key, $className = null)
11801181
{
1181-
$relation = new ParseRelation($this, $key);
1182-
if (isset($this->estimatedData[$key])) {
1182+
$relation = new ParseRelation($this, $key, $className);
1183+
if (!$className && isset($this->estimatedData[$key])) {
11831184
$object = $this->estimatedData[$key];
11841185
if ($object instanceof ParseRelation) {
11851186
$relation->setTargetClass($object->getTargetClass());

0 commit comments

Comments
 (0)