-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish first draft of all helper pages
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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". |