Skip to content

Commit

Permalink
Public release
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLuckers committed Apr 29, 2020
0 parents commit 6379c89
Show file tree
Hide file tree
Showing 28 changed files with 2,827 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior, including custom code if needed.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**
- OS: [e.g. macOS]
- Database: [e.g. mysql, mariadb]
- xPDO and/or MODX Version: [e.g. xPDO 2.7.0-pl, MODX 2.7.2]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
### Composer ###
composer.phar
vendor/

### PHPUnit ###
phpunit.xml

### Config files ###
tests/properties.inc.php

### OSX ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### PhpStorm ###
.idea

# IntelliJ
out/

# Editor-based Rest Client
.idea/httpRequests

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-present Springbok Agency BV (https://www.springbokagency.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Faker xPDO ORM Adapter

A [Faker](https://github.com/fzaninotto/Faker) ORM adapter to populate [xPDO](http://xpdo.org) objects with fake data.

# Table of contents

- [Installation](#installation)
- [Usage](#usage)

## Installation

Install as development dependency using [Composer](https://getcomposer.org).

``` bash
$ composer require --dev springbokagency/faker-xpdo-orm-adapter
```

## Usage
To populate xPDO objects, create a new populator class (using a generator instance as parameter), then list the class and number of all the objects that must be generated. To launch the actual data population, call the execute() method.

Here is an example showing how to populate 5 `modUser` and 10 `modResource` objects:

```php
<?php
$generator = \Faker\Factory::create();
$populator = new \SpringbokAgency\Faker\ORM\xPDO\Populator($generator);
$populator->addEntity(\modUser::class, 5);
$populator->addEntity(\modResource::class, 10);
$insertedPKs = $populator->execute();
```

For more info read [the Faker documentation](https://github.com/fzaninotto/Faker#populating-entities-using-an-orm-or-an-odm).
47 changes: 47 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "springbokagency/faker-xpdo-orm-adapter",
"type": "library",
"description": "xPDO ORM adapter for faker",
"license": "MIT",
"authors": [
{
"name": "Joshua Lückers",
"email": "joshua.luckers@springbokagency.com"
}
],
"repositories": [
{
"type": "package",
"package": {
"name": "modxcms/xpdo2",
"version": "v2.8.0-pl",
"source": {
"url": "git@github.com:modxcms/xpdo.git",
"type": "git",
"reference": "origin/2.x"
}
}
}
],
"require": {
"fzaninotto/faker": "^1.9.1"
},
"require-dev": {
"modxcms/xpdo2": "^2.8",
"phpunit/phpunit": "~6.5"
},
"autoload": {
"psr-4": {
"SpringbokAgency\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"SpringbokAgency\\Tests\\": "tests/"
},
"classmap": [
"vendor/modxcms/xpdo2/xpdo/",
"tests/test_package/core/components/faker-xpdo-orm-adapter/model/faker-xpdo-orm-adapter/"
]
}
}
Loading

0 comments on commit 6379c89

Please sign in to comment.