Elgg /
Elgg
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Elgg\Database\Seeds; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Abstract seed |
||
| 7 | * |
||
| 8 | * Plugins should extend this class to create their own seeders, |
||
| 9 | * add use 'seeds','database' plugin hook to add their seed to the sequence. |
||
| 10 | */ |
||
| 11 | abstract class Seed implements Seedable { |
||
| 12 | |||
| 13 | use Seeding; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Seed constructor. |
||
| 17 | * |
||
| 18 | * @param null $limit Number of item to seed |
||
| 19 | */ |
||
| 20 | public function __construct($limit = null) { |
||
| 21 | if (isset($limit)) { |
||
| 22 | $this->limit = $limit; |
||
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Populate database |
||
| 28 | * @return mixed |
||
| 29 | */ |
||
| 30 | abstract function seed(); |
||
|
0 ignored issues
–
show
|
|||
| 31 | |||
| 32 | /** |
||
| 33 | * Removed seeded rows from database |
||
| 34 | * @return mixed |
||
| 35 | */ |
||
| 36 | abstract function unseed(); |
||
|
0 ignored issues
–
show
|
|||
| 37 | |||
| 38 | } |
||
| 39 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.