Skip to content

Commit

Permalink
Finish first draft of all helper pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jkniest committed Jun 16, 2024
1 parent fb13b89 commit f226024
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/helpers/database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Database Helpers

The database helpers provide a more generic way of handling with the database in comparision to the other helper methods.

## deleteEntities
The `deleteEntities` method allows a fixture to delete all entities which match a given criteria. It takes the entity name and criteria as parameter and deletes all found entities.

```php
<?php

class MyFixture extends Fixture {
public function load(): void {
$this->helper->Database()->deleteEntities( // [!code focus]
entity: ProductDefinition::ENTITY_NAME, // [!code focus]
criteria: (new Criteria())->addFilter(new EqualsFilter('name', 'Example')) // [!code focus]
); // [!code focus]
}
}
```

This example would remove all products which have the name: "Example".

0 comments on commit f226024

Please sign in to comment.