Merge remote-tracking branch 'origin/1.3.x' into fix-nested-id-required
This commit is contained in:
commit
fb130f3aa2
1 changed files with 19 additions and 0 deletions
|
@ -4,6 +4,7 @@ namespace Appwrite\Utopia\Response\Model;
|
|||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
use Utopia\Database\Document;
|
||||
|
||||
class Team extends Model
|
||||
{
|
||||
|
@ -49,6 +50,24 @@ class Team extends Model
|
|||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Document before returning it to the client
|
||||
*
|
||||
* @return Document
|
||||
*/
|
||||
public function filter(Document $document): Document
|
||||
{
|
||||
$prefs = $document->getAttribute('prefs');
|
||||
if ($prefs instanceof Document) {
|
||||
$prefs = $prefs->getArrayCopy();
|
||||
}
|
||||
|
||||
if (is_array($prefs) && empty($prefs)) {
|
||||
$document->setAttribute('prefs', new \stdClass());
|
||||
}
|
||||
return $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue