/** * 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); }
/** * @test */ public function commonEntityIsNotFalselyIdentifiedAsFrequentlyWritten() { $entity = ['some_field' => 'value']; $this->assertFalse($this->entityInfo->isFrequentlyWrittenEntity($entity)); }