PHP code example of ang3 / odoo-bundle

1. Go to this page and download the library: Download ang3/odoo-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ang3 / odoo-bundle example snippets


use Ang3\Bundle\OdooBundle\ClientRegistry;

class MyService
{
    private $clientRegistry;

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

use Ang3\Component\Odoo\Client;

class MyService
{
    private $client;

    public function __construct(Client $client)
    {
        $this->client = $client;
    }
}
 bin/console debug:autowiring Client

namespace App;

use Ang3\Component\Odoo\ORM\ObjectManager;

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

    public function __construct(ObjectManager $objectManager)
    {
        $this->objectManager = $objectManager;
    }
}
 bin/console debug:autowiring ObjectManager

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;
}