/** * @test */ public function commonEntityIsNotFalselyIdentifiedAsIgnored() { $entity = ['some_field' => 'value']; $this->assertFalse($this->entityInfo->isIgnoredEntity($entity)); $entity = ['some_field' => 'value', 'other_field' => 'b']; $this->assertFalse($this->entityInfo->isIgnoredEntity($entity)); }
/** * True / false if the entity should be saved / ignored. Works as a filtering method. * * @param array $data * @return bool */ public function shouldBeSaved($data) { $shouldBeSaved = true; if ($this->entityInfo->isIgnoredEntity($data)) { $shouldBeSaved = false; } if ($this->ignoreFrequentlyWrittenEntities) { $isFrequentlyWrittenEntity = $this->entityInfo->isFrequentlyWrittenEntity($data); $shouldBeSaved = $shouldBeSaved && !$isFrequentlyWrittenEntity; } $entityName = $this->entityInfo->entityName; return apply_filters("vp_entity_should_be_saved_{$entityName}", $shouldBeSaved, $data, $this); }