Download the PHP package oasis/doctrine-addon without Composer

On this page you can find all versions of the php package oasis/doctrine-addon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package doctrine-addon

oasis/doctrine-addon

Doctrine ORM 扩展组件,提供:

Installation

AutoIdTrait

use AutoIdTrait 即可获得自增整数主键 $idgetId() 方法:

The Cascade Removal Problem

当 ORM 启用 Second Level Cache 并使用数据库 ON DELETE CASCADE 约束时,删除父 entity 后:

  1. Identity map 脏数据$em->find() 仍然返回已被数据库删除的子 entity
  2. 二级缓存脏数据 — 缓存中仍持有已删除 entity 的数据
  3. 关联集合不一致 — 持有被删除 entity 引用的其他 entity,其集合未被刷新

例如:Team entity 持有 User 集合。删除一个 User 后,访问 Team 的 members 集合仍会拿到已删除的 User 引用,导致异常。

Doctrine 原生方案各有缺陷:

CascadeRemoveTrait Solution

通过 Doctrine 生命周期回调,在 PreRemove 阶段递归收集关联实体,在 PostRemove 阶段统一 detach + evict + refresh。实际删除由数据库 ON DELETE CASCADE 完成。

Prerequisites

Usage

Key Concepts

概念 说明 getCascadeRemoveableEntities() 返回
强关联实体 当前实体删除时也应删除的实体 Category → Article
弱关联实体 持有当前实体引用、需刷新缓存的实体 Article → Tag(通过 getDirtyEntitiesOnInvalidation()

What the Trait Does

阶段 强关联实体 弱关联实体
PreRemove 递归收集 收集(排除已在强关联列表中的)
PostRemove detach from EM + evict from L2 cache evict from L2 cache + refresh from DB

完整的 CMS 示例(Category / Article / Tag)见 ut/Entity/ 目录。

Development

详见 docs/manual/development.md

License

MIT


All versions of doctrine-addon with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
oasis/logging Version ^3.0
doctrine/orm Version ^3.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package oasis/doctrine-addon contains the following files

Loading the files please wait ...