PHPackages                             byng-systems/pimcore-doctrine-library - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. byng-systems/pimcore-doctrine-library

ActiveLibrary[Database &amp; ORM](/categories/database)

byng-systems/pimcore-doctrine-library
=====================================

Byng pimcore doctrine library

1.0.0(10y ago)022MITPHPPHP &gt;=5.5.0

Since Dec 24Pushed 10y ago5 watchersCompare

[ Source](https://github.com/byng-systems/pimcore-doctrine-library)[ Packagist](https://packagist.org/packages/byng-systems/pimcore-doctrine-library)[ Docs](https://github.com/byng-systems/pimcore-doctrine-library)[ RSS](/packages/byng-systems-pimcore-doctrine-library/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Pimcore doctrine plugin
=======================

[](#pimcore-doctrine-plugin)

This plugin allows developers to use doctrine orm to manage objects outside of pimcore.

Usage
=====

[](#usage)

Installation
------------

[](#installation)

Add the plugin in composer.json

```
"require": {
    "byng-systems/pimcore-doctrine-library": "1.0.0"
}
```

You will also need to add a post-install script to install the doctrine cli script. If you don't add the following line then you will have to manually copy 'cli-config.php' from inside the plugin folder to your document root.

```
"scripts": {
    "post-install-cmd": "Byng\\Pimcore\\Doctrine\\Composer\\CliManager::postInstall",
    "post-update-cmd": "Byng\\Pimcore\\Doctrine\\Composer\\CliManager::postInstall"
}
```

Setup
-----

[](#setup)

Add the following to 'website/var/config/startup.php'. Set the $entityDir to wherever you wish to create your entities.

```
$entityDir = PIMCORE_DOCUMENT_ROOT . "/website/lib/Entity";
$setup = new \Byng\Pimcore\Doctrine\Setup([$entityDir]);
$em = $setup->init();
```

You can store the entity manager reference ($em) in your DI container or Zend\_Registry if you wish. You can also retrieve it from the setup class from anywhere in your code base:

```
$em = \Byng\Pimcore\Doctrine\Setup::getEntityManager();
```

Test
----

[](#test)

Open a terminal and 'cd' to your document root and run the following command:

```
./vendor/bin/doctrine
```

You should see a list of all available doctrine commands

Example
-------

[](#example)

Create a product entity

NB: You'll probably have to add the 'Entity' namespace to your autoloader.

website/lib/Entity/Product.php

```
