Skip to content

Commit

Permalink
Merge branch 'main' into feature/allow-symfony-7
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris53897 authored Nov 27, 2023
2 parents 7339924 + 922e6b2 commit bf7eb73
Show file tree
Hide file tree
Showing 56 changed files with 600 additions and 540 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
14 changes: 7 additions & 7 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand All @@ -27,15 +27,15 @@ jobs:
dependency-versions: "highest"

- name: "Run PHP-CS-Fixer"
run: "bin/php-cs-fixer fix --ansi --verbose --diff --dry-run"
run: "vendor/bin/php-cs-fixer fix --ansi --verbose --diff --dry-run"

rector:
name: "Rector"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Install PHP"
uses: shivammathur/setup-php@v2
Expand All @@ -51,7 +51,7 @@ jobs:
composer-options: "--prefer-dist --prefer-stable"

- name: Rector
run: "bin/rector --no-progress-bar --dry-run"
run: "vendor/bin/rector --no-progress-bar --dry-run"

composer:
name: Composer
Expand All @@ -60,7 +60,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
Expand All @@ -81,7 +81,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install required dependencies
run: sudo apt-get update && sudo apt-get install libxml2-utils
Expand All @@ -96,7 +96,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Ruby 3.0
uses: ruby/setup-ruby@v1
Expand Down
22 changes: 5 additions & 17 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

jobs:
phpunit:
name: "PHPUnit ${{ matrix.php-version }} (${{ matrix.deps }})${{ matrix.dbal-version && format(' - DBAL {0}', matrix.dbal-version) || '' }}"
name: "PHPUnit ${{ matrix.php-version }} (${{ matrix.deps }})"
runs-on: "ubuntu-20.04"

services:
Expand All @@ -29,23 +29,15 @@ jobs:
- "8.2"
deps:
- "highest"
dbal-version:
- ""
include:
- deps: "lowest"
php-version: "7.4"
- deps: "highest"
php-version: "8.2"
dbal-version: "^2.13.1"
- deps: "highest"
php-version: "8.2"
dbal-version: "^3.2"
- deps: "highest"
php-version: "8.1"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

Expand All @@ -59,10 +51,6 @@ jobs:
- name: "Temp: test Symfony 7 RC"
run: "composer config minimum-stability RC"

- name: "Restrict DBAL version"
if: "${{ matrix.dbal-version }}"
run: "composer require --dev --no-update doctrine/dbal:${{ matrix.dbal-version }}"

# Remove PHP-CS-Fixer to avoid conflicting dependency ranges (i.e. doctrine/annotations)
- name: "Remove PHP-CS-Fixer"
run: "composer remove --dev --no-update friendsofphp/php-cs-fixer"
Expand All @@ -73,7 +61,7 @@ jobs:
dependency-versions: "${{ matrix.deps }}"

- name: "Run PHPUnit"
run: "bin/phpunit -c tests --coverage-clover coverage.xml"
run: "vendor/bin/phpunit -c tests --coverage-clover coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v3"
Expand All @@ -88,7 +76,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand All @@ -115,7 +103,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qa-dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
name: Build containers with Docker Compose
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build "php" container
uses: isbang/compose-action@v1.5.1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
Expand All @@ -31,4 +31,4 @@ jobs:
composer-options: --prefer-dist --prefer-stable --no-interaction --no-progress

- name: PHPStan
run: bin/phpstan --memory-limit=1G analyse --error-format=github
run: vendor/bin/phpstan --memory-limit=1G analyse --error-format=github
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ a release.
---

## [Unreleased]
### Added
- Tree: Added `@template` and `@template-extends` annotations to the Tree repositories

### Changed
- Dropped support for PHP < 7.4
- Dropped support for Symfony < 5.4
- Dropped support for doctrine/dbal < 3.2

### Deprecated
- Calling `Gedmo\Mapping\Event\Adapter\ORM::getObjectManager()` and `getObject()` on EventArgs that do not implement `getObjectManager()` and `getObject()` (such as old EventArgs implementing `getEntityManager()` and `getEntity()`)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ To set up and run the tests, follow these steps:
- From the project root, run `docker compose up -d` to start containers in daemon mode
- Enter the container via `docker compose exec php bash` (you are now in the root directory: `/var/www`)
- Install Composer dependencies via `composer install`
- Run the tests: `bin/phpunit -c tests/`
- Run the tests: `vendor/bin/phpunit -c tests/`

### Running the Example

Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"require-dev": {
"doctrine/cache": "^1.11 || ^2.0",
"doctrine/dbal": "^2.13.1 || ^3.2",
"doctrine/dbal": "^3.2",
"doctrine/doctrine-bundle": "^2.3",
"doctrine/mongodb-odm": "^2.3",
"doctrine/orm": "^2.14.0",
Expand All @@ -69,7 +69,7 @@
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
},
"conflict": {
"doctrine/dbal": "<2.13.1 || ^3.0 <3.2",
"doctrine/dbal": "<3.2",
"doctrine/mongodb-odm": "<2.3",
"doctrine/orm": "<2.14.0 || 2.16.0 || 2.16.1",
"sebastian/comparator": "<2.0"
Expand All @@ -89,7 +89,6 @@
}
},
"config": {
"bin-dir": "bin",
"sort-packages": true
},
"extra": {
Expand Down
37 changes: 37 additions & 0 deletions example/app/Entity/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

namespace App\Entity;

use App\Entity\Repository\CategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

Expand All @@ -23,13 +25,20 @@
*
* @Gedmo\TranslationEntity(class="App\Entity\CategoryTranslation")
*/
#[Gedmo\Tree(type: 'nested')]
#[ORM\Table(name: 'ext_categories')]
#[ORM\Entity(repositoryClass: CategoryRepository::class)]
#[Gedmo\TranslationEntity(class: CategoryTranslation::class)]
class Category
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
#[ORM\Column(type: Types::INTEGER)]
#[ORM\Id]
#[ORM\GeneratedValue]
private $id;

/**
Expand All @@ -39,6 +48,8 @@ class Category
*
* @ORM\Column(length=64)
*/
#[Gedmo\Translatable]
#[ORM\Column(length: 64)]
private $title;

/**
Expand All @@ -48,6 +59,8 @@ class Category
*
* @ORM\Column(type="text", nullable=true)
*/
#[Gedmo\Translatable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private $description;

/**
Expand All @@ -58,20 +71,27 @@ class Category
*
* @ORM\Column(length=64, unique=true)
*/
#[Gedmo\Translatable]
#[Gedmo\Slug(fields: ['created', 'title'])]
#[ORM\Column(length: 64, unique: true)]
private $slug;

/**
* @Gedmo\TreeLeft
*
* @ORM\Column(type="integer")
*/
#[Gedmo\TreeLeft]
#[ORM\Column(type: Types::INTEGER)]
private $lft;

/**
* @Gedmo\TreeRight
*
* @ORM\Column(type="integer")
*/
#[Gedmo\TreeRight]
#[ORM\Column(type: Types::INTEGER)]
private $rgt;

/**
Expand All @@ -80,53 +100,69 @@ class Category
* @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
*/
#[Gedmo\TreeParent]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
private $parent;

/**
* @Gedmo\TreeRoot
*
* @ORM\Column(type="integer", nullable=true)
*/
#[Gedmo\TreeRoot]
#[ORM\Column(type: Types::INTEGER, nullable: true)]
private $root;

/**
* @Gedmo\TreeLevel
*
* @ORM\Column(name="lvl", type="integer")
*/
#[Gedmo\TreeLevel]
#[ORM\Column(name: 'lvl', type: Types::INTEGER)]
private $level;

/**
* @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
*/
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
private Collection $children;

/**
* @Gedmo\Timestampable(on="create")
*
* @ORM\Column(type="datetime")
*/
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private $created;

/**
* @Gedmo\Timestampable(on="update")
*
* @ORM\Column(type="datetime")
*/
#[Gedmo\Timestampable(on: 'update')]
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private $updated;

/**
* @Gedmo\Blameable(on="create")
*
* @ORM\Column(type="string")
*/
#[Gedmo\Blameable(on: 'create')]
#[ORM\Column(type: Types::STRING)]
private $createdBy;

/**
* @Gedmo\Blameable(on="update")
*
* @ORM\Column(type="string")
*/
#[Gedmo\Blameable(on: 'update')]
#[ORM\Column(type: Types::STRING)]
private $updatedBy;

/**
Expand All @@ -136,6 +172,7 @@ class Category
* cascade={"persist", "remove"}
* )
*/
#[ORM\OneToMany(targetEntity: CategoryTranslation::class, mappedBy: 'object', cascade: ['persist', 'remove'])]
private $translations;

public function __construct()
Expand Down
Loading

0 comments on commit bf7eb73

Please sign in to comment.