Merge pull request #868 from TorstenDittmann/migration-qa
Fix filters enable/disable on databases
This commit is contained in:
commit
e0cd3aaf5e
1 changed files with 8 additions and 4 deletions
|
@ -475,6 +475,10 @@ class Database
|
||||||
|
|
||||||
public function encode(Document $document):Document
|
public function encode(Document $document):Document
|
||||||
{
|
{
|
||||||
|
if (!self::$statusFilters) {
|
||||||
|
return $document;
|
||||||
|
}
|
||||||
|
|
||||||
$collection = $this->getDocument($document->getCollection(), true , false);
|
$collection = $this->getDocument($document->getCollection(), true , false);
|
||||||
$rules = $collection->getAttribute('rules', []);
|
$rules = $collection->getAttribute('rules', []);
|
||||||
|
|
||||||
|
@ -511,6 +515,10 @@ class Database
|
||||||
|
|
||||||
public function decode(Document $document):Document
|
public function decode(Document $document):Document
|
||||||
{
|
{
|
||||||
|
if (!self::$statusFilters) {
|
||||||
|
return $document;
|
||||||
|
}
|
||||||
|
|
||||||
$collection = $this->getDocument($document->getCollection(), true , false);
|
$collection = $this->getDocument($document->getCollection(), true , false);
|
||||||
$rules = $collection->getAttribute('rules', []);
|
$rules = $collection->getAttribute('rules', []);
|
||||||
|
|
||||||
|
@ -575,10 +583,6 @@ class Database
|
||||||
*/
|
*/
|
||||||
static protected function decodeAttribute(string $name, $value)
|
static protected function decodeAttribute(string $name, $value)
|
||||||
{
|
{
|
||||||
if (!self::$statusFilters) {
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset(self::$filters[$name])) {
|
if (!isset(self::$filters[$name])) {
|
||||||
return $value;
|
return $value;
|
||||||
throw new Exception('Filter not found');
|
throw new Exception('Filter not found');
|
||||||
|
|
Loading…
Reference in a new issue