Skip to content

Commit

Permalink
Merge pull request #97 from dimitriBouteille/update-doc
Browse files Browse the repository at this point in the history
Update doc
  • Loading branch information
dimitriBouteille authored Nov 27, 2024
2 parents 223c5c8 + 3e6728d commit 7b640c1
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 269 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'no_unused_imports' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'blank_line_after_opening_tag' => false,
'header_comment' => [
'header' => $header,
'comment_type' => 'PHPDoc',
Expand Down
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,29 @@
WordPress ORM with Eloquent is a small library that adds a basic ORM into WordPress, which is easily extendable and includes models for core WordPress models such as posts, post metas, users, comments and more.
The ORM is based on [Eloquent ORM](https://laravel.com/docs/eloquent) and uses the WordPress connection (`wpdb` class).

> 💡 To simplify the integration of this library, we recommend using WordPress with one of the following tools: [Bedrock](https://roots.io/bedrock/), [Themosis](https://framework.themosis.com/) or [Wordplate](https://github.com/wordplate/wordplate#readme).
> [!TIP]
> To simplify the integration of this library, we recommend using WordPress with one of the following tools: [Bedrock](https://roots.io/bedrock/), [Themosis](https://framework.themosis.com/) or [Wordplate](https://github.com/wordplate/wordplate#readme).
### Features
## Features

- ✅ Support core WordPress models: `Comment`, `Option`, `Post`, `TermTaxonomy`, `Term`, `User`, `PostMeta` and `UserMeta`
- ✅ Support core WordPress post type: `Article`, `Attachment` and `Page`
- ✅ Based on core WordPress database connection (`wpdb` class), no configuration required !
- ✅ Custom functions to filter models with meta
- ❤️ Easy integration of a custom post type
- ✅ Meta casting (e.g. [Attribute Casting](https://laravel.com/docs/eloquent-mutators#attribute-casting))
- ❤️ Easy integration of a custom post and comment type
- ❤️ Easy model creation for projects with custom tables
- ❤️ All the features available in Eloquent, are usable with this library !

**Not yet developed but planned in a future version:**

- 🗓️ Create custom comment type
- 🗓️ Meta casting (e.g. [Attribute Casting](https://laravel.com/docs/10.x/eloquent-mutators#attribute-casting))
- 🗓️ [Create migration tool with Eloquent](https://github.com/dimitriBouteille/wp-orm/issues/28)

### Documentation
## Documentation

This documentation only covers the specific points of this library, if you want to know more about Eloquent, the easiest is to look at [the documentation of Eloquent](https://laravel.com/docs/10.x/eloquent) :)
This documentation only covers the specific points of this library, if you want to know more about Eloquent, the easiest is to look at [the documentation of Eloquent](https://laravel.com/doc/eloquent).

- [Installation](#installation)
- [Use WordPress core models](doc/wordpress-core-models.md)
- [Filter data](/doc/filter-data.md)
- [With findOneBy*](/doc/filter-data.md#with-findoneby)
- [With taps](/doc/filter-data.md#with-taps)
- [With query builder](/doc/filter-data.md#with-query-builder)
- [Events](/doc/events.md)
- [Create custom model](doc/create-model.md)
- [Generic Model](doc/create-model.md#generic-model)
- [Custom Post Type Model](doc/create-model.md#custom-post-type-model)
You can find all the documentation in [the wiki](https://github.com/dimitriBouteille/wp-orm/wiki).

## Installation

Expand Down
25 changes: 0 additions & 25 deletions doc/available-filters.md

This file was deleted.

63 changes: 0 additions & 63 deletions doc/create-model.md

This file was deleted.

58 changes: 0 additions & 58 deletions doc/events.md

This file was deleted.

86 changes: 0 additions & 86 deletions doc/filter-data.md

This file was deleted.

19 changes: 0 additions & 19 deletions doc/wordpress-core-models.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/Orm/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public function transaction(\Closure $callback, $attempts = 1)
// We'll simply execute the given callback within a try / catch block and if we
// catch any exception we can rollback this transaction so that none of this
// gets actually persisted to a database or stored in a permanent fashion.
$data = $callback();
$data = $callback($this);
$this->commit();
return $data;
} catch (\Exception $e) {
Expand Down

0 comments on commit 7b640c1

Please sign in to comment.