PHPackages                             ang3/odoo-bundle - 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. ang3/odoo-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

ang3/odoo-bundle
================

Symfony bundle to manage your Odoo databases.

v0.1.3(5y ago)64.4k↓47.8%5[1 PRs](https://github.com/Ang3/odoo-bundle/pulls)MITPHPPHP &gt;=7.2.5

Since Jul 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Ang3/odoo-bundle)[ Packagist](https://packagist.org/packages/ang3/odoo-bundle)[ RSS](/packages/ang3-odoo-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (12)Versions (6)Used By (0)

Odoo bundle
===========

[](#odoo-bundle)

[![Build Status](https://camo.githubusercontent.com/6505fe4467ed90cc5988bcec84e7b32d11a80f1ccb82cf60316971d238836f71/68747470733a2f2f7472617669732d63692e6f72672f416e67332f6f646f6f2d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Ang3/odoo-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/1902925b5da9b7dd74f4a7b4bff59bcba0cd80600b8817d4cb436eb3b47b64e2/68747470733a2f2f706f7365722e707567782e6f72672f616e67332f6f646f6f2d62756e646c652f762f737461626c65)](https://packagist.org/packages/ang3/odoo-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/73aaafd83f408749911090997e8e2351b147dbe8e3a6e802daacc5c26aa787f3/68747470733a2f2f706f7365722e707567782e6f72672f616e67332f6f646f6f2d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/ang3/odoo-bundle)[![Total Downloads](https://camo.githubusercontent.com/96579d57c35fc8a54a3cbb2762e896af764e5b66c08070a402cab7166ed81ab0/68747470733a2f2f706f7365722e707567782e6f72672f616e67332f6f646f6f2d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/ang3/odoo-bundle)

This bundle is a Symfony integration of packages [ang3/php-odoo-api-client](https://packagist.org/packages/ang3/php-odoo-api-client) and [ang3/php-odoo-orm](https://packagist.org/packages/ang3/php-odoo-api-client).

**Main features:**

- Client registry
- Object relational mapping (ORM)
- Debugging commands
- Record validator

Documentation of both packages:

PackageDocumentationang3/php-odoo-api-clientang3/php-odoo-ormInstallation
============

[](#installation)

Step 1: Download the Bundle
---------------------------

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require ang3/odoo-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Step 2: Configure your app
--------------------------

[](#step-2-configure-your-app)

Create the file `config/packages/ang3_odoo.yaml` and paste the configuration below:

```
# app/config/config.yml or config/packages/ang3_odoo.yaml
ang3_odoo:
  default_connection: default
  default_logger: '' # Instance of \Psr\Log\LoggerInterface (optional)
  # If set, the default logger is used if a connection hasn't one
  connections:
    default:
      url: '%env(resolve:ODOO_API_URL)%'
      database: '%env(resolve:ODOO_API_DATABASE)%'
      user: '%env(resolve:ODOO_API_USERNAME)%'
      password: '%env(resolve:ODOO_API_PASSWORD)%'
      logger: '' # Instance of \Psr\Log\LoggerInterface (optional)
  orm:
    enabled: false
```

Finally, set needed `.env` vars to your project:

```
ODOO_API_URL=
ODOO_API_DATABASE=
ODOO_API_USERNAME=
ODOO_API_PASSWORD=

```

#### Work with multiple connections (optional)

[](#work-with-multiple-connections-optional)

You can add more connection under section `ang3_odoo.connections`. Here is an example for another connection:

```
# app/config/config.yml or config/packages/ang3_odoo.yaml
ang3_odoo:
  # ...
  connections:
    default:
      # ...
    other_connection_name:
      url: '...'
      database: '...'
      user: '...'
      password: '...'
      logger: '' # optional
```

The parameter `default_connection` is used to define the default connection to use.

Usage
=====

[](#usage)

Registry
--------

[](#registry)

If you want to work with all your configured clients, then you may want to get the *registry*. It stores all configured clients by connection name. You can get it by dependency injection:

```
use Ang3\Bundle\OdooBundle\ClientRegistry;

class MyService
{
    private $clientRegistry;

    public function __construct(ClientRegistry $clientRegistry)
    {
        $this->clientRegistry = $clientRegistry;
    }
}
```

The registry contains three useful methods:

- `public function set(string $connectionName, Client $client): self` Set a client by connection name.
- `public function get(string $connectionName): Client` Get the client of a connection. A `\LogicException` is thrown if the connection was not found.
- `public function has(string $connectionName): bool` Check if a connection exists by name.

If you don't use autowiring, you must pass the service as argument of your service:

```
# app/config/services.yml or config/services.yaml
# ...
MyClass:
    arguments:
        $clientRegistry: '@ang3_odoo.client_registry'
```

Clients
-------

[](#clients)

It could be useful to get a client directly without working with the registry.

For example, the get the default client by autowiring, use the argument `Ang3\Component\Odoo\Client $client`:

```
use Ang3\Component\Odoo\Client;

class MyService
{
    private $client;

    public function __construct(Client $client)
    {
        $this->client = $client;
    }
}
```

If the connection name is `foo_bar`, then the autowired argument is `Ang3\Component\Odoo\Client $fooBarClient`.

- Run the command `php bin/console debug:autowiring Client` to get the list of autowired clients.

Of course if you don't use autowiring, you must pass the service as argument of your service:

```
# app/config/services.yml or config/services.yaml
# ...
App\MyService:
    arguments:
        $client: '@ang3_odoo.client.' # Or '@ang3_odoo.client' for the default connection
```

For each client, the bundle creates a public alias following this naming convention: `ang3_odoo.client.`.

ORM
---

[](#orm)

To enable ORM features, you must edit the file `config/packages/ang3_odoo.yaml` to configure it:

```
ang3_odoo:
  # ...
  orm:
    enabled: true # Do not forget to enable the ORM
    managers:
      default: # connection name to manage
        paths: # List of directories where your Odoo objects are stored
          - '%kernel_project_dir%/src/Odoo/Entity'
```

#### Usage

[](#usage-1)

Get the manager of a connection easily by using dependency injection and autowiring:

```
namespace App;

use Ang3\Component\Odoo\ORM\ObjectManager;

class MyService
{
    /**
     * @var  ObjectManager
    */
    private $objectManager;

    public function __construct(ObjectManager $objectManager)
    {
        $this->objectManager = $objectManager;
    }
}
```

If the connection name is `foo_bar`, then the autowired argument is `Ang3\Component\Odoo\ORM\ObjectManager $fooBarObjectManager`. By default, the default manager is autowired.

- Run the command `php bin/console debug:autowiring ObjectManager` to get the list of autowired managers.

Of course if you don't use autowiring, you must pass the service as argument of your service:

```
# app/config/services.yml or config/services.yaml
# ...
App\MyService:
    arguments:
        $objectManager: '@ang3_odoo.orm.object_manager.' # Or '@ang3_odoo.orm.object_manager' for the default manager
```

For each manager, the bundle creates a public alias following this naming convention: `ang3_odoo.orm.object_manager.`.

Please read the documentation of the ORM package [ang3/php-odoo-orm](https://github.com/Ang3/php-odoo-orm)to know more information about the object manager.

Validator
---------

[](#validator)

This bundle provides a useful validator according to the package [symfony/validator](https://symfony.com/doc/current/components/validator.html)to validate a record by ID, domains and/or connection. It resides to a basic annotation.

Here is an example of an object storing the ID of a company and invoice:

```
use Ang3\Bundle\OdooBundle\Validator\Constraints as Odoo;

class MyEntity
{
    /**
     * @var int
     *
     * @Odoo\Record("res.company")
     * ...
     */
    private $companyId;

    /**
     * @var int
     *
     * @Odoo\Record(model="account.move", domains="expr.eq('company_id.id', this.companyId)", connection="default")
     * ...
     */
    private $invoiceId;
}
```

Here is the list of all options you can pass to the annotation:

- `model` (**required** string) The model name of the record.
- `domains` (string) An expression which evaluation must returns valid client criteria.
- `connection` (string) the name of the connection to use
    - By default the `default` connection is used.
- `typeErrorMessage` (string) The error message if the value is not a positive integer
    - By default the message is: `This value must be a positive integer.`
- `notFoundMessage` (string) The message if the record was not found
    - By default the message is: `The record of ID {{ model_id }} from "{{ model_name }}" was not found.`

As you can see, the validator uses both [symfony/expression-language](https://symfony.com/doc/current/components/expression_language.html)and the expression builder provided with the client. By this way, you can filter allowed records easily.

Here are the variable passed to the evaluated expression:

- `expr` the expression builder
- `this` the object that the property/getter belongs to
- `user` the user of the request `Symfony\Component\Security\Core\User\UserInterface|null`

Upgrades &amp; updates
======================

[](#upgrades--updates)

### v0.1.0 (beta-release)

[](#v010-beta-release)

- Client registry
- Beta ORM
    - Registry
    - Configuration
    - Cache
- Record validator

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~59 days

Total

4

Last Release

1955d ago

PHP version history (2 changes)v0.1.0PHP ^7.4

v0.1.1PHP &gt;=7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/d85891b6716c7a111bc56143f6b165b3c76e84a575ef4ab26f4fa8c8694489ef?d=identicon)[Ang3](/maintainers/Ang3)

---

Top Contributors

[![Ang3](https://avatars.githubusercontent.com/u/7427494?v=4)](https://github.com/Ang3 "Ang3 (48 commits)")

---

Tags

apiclientbundlepersistencedatabaseormdbalobjectodoo

### Embed Badge

![Health badge](/badges/ang3-odoo-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ang3-odoo-bundle/health.svg)](https://phpackages.com/packages/ang3-odoo-bundle)
```

###  Alternatives

[doctrine/doctrine-bundle

Symfony DoctrineBundle

4.8k241.3M3.3k](/packages/doctrine-doctrine-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[kreait/firebase-bundle

Symfony Bundle for the Firebase Admin SDK

1534.7M2](/packages/kreait-firebase-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
