OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Maximum business unit

This topic contains 7 replies, has 3 voices, and was last updated by  dimitri.seguin17 6 years, 10 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #33937



    I have to open orocrm extranet, but I need over 15 000 business unit.
    I have approximatively 16 000 business unit, I can’t login as admin.

    Is there a limit of business unit?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
  • #33938

    Artem Liubeznyi

    Hi Dimitri,

    There are no limits for the number of business units in the system, so you may create as much as you need.



    Ok thank’s for your answer

    I actualy have a script that import approximatively 18 000 business unit in my orocrm instance.
    This import run successuly.
    But after the import when i want to connect as admin (role admin) to the oro http interface, i get an php timeout error.

    Does the number of business unit present in the db have a major impact on the performances, and can explain the error i have ?
    the admin user belong to the ‘main’ business unit

    Have you an idea to solve this problem ? Or some advice on where looking for



    After looking into oro code i found the timeout is due to the method OwnerTreeProvider.fillTree() that take very long time when the number of Business Unit grow.

    I see that the result of this method is cache but i don’t understand the scope of this cache and how it is invalidate.
    Does someone know if it is possible to prewarm this cache with a cron job to avoid timeout on http calls ?

    Thanks in advance



    Hello, I want to update oroplatform code.

    I want to change a user scope to global scope. In fact, warm the cache for all sessions and not for one session.

    And when I have new business unit, whether rewarm all cache or just update cache with a new business unit.

    It’s a good idea or not ?


    Dima Soroka

    Hi Dmitri

    Why you would like to change users ownership type to system (we would like to understand the reason of the request)? The main idea behind current (business unit) ownership type is that each business units could manage own users. Changing ownership type for user will have very big impact on business logic and will not accept it without good reason behind.




    Hi Dima,

    Thanks for your answer.
    i will try to be more understandable :)

    I don’t want to change the scope of the ownershop type.
    I just suggest to change the scope of the cache that is construct when a user load. To allow all user to shared the same cache objet.
    And update this cache at right change instead of user login.
    But i’m not sure to understand all the implications of this change.
    Maybe there is a better way to fix the performance issue i have when i add a lot of business unit in my instance.
    What was the best way to build this cache object at an another moment than the user login ?

    Thanks in advance,





    Finaly i understand that the performance problem came from the method OwnerTreeListener:checkEntities() that consider the OwerTreeProvider cache must be invalidate because the User Entity was change. Fields login_count and last_login were change due to login but theses two fields are not involved in the cache calculation.
    So i modified the OwnerTreeListener:checkEntities() like below to exclude theses fields of the changes check.
    With modifications the OwerTreeProvider cache is no more rebuild at each login and i have no more performance issue when i import a lot of Business Unit.

    protected function checkEntities(array $entities)
    $uow = $this->container->get('doctrine.orm.entity_manager')->getUnitOfWork();

    foreach ($entities as $entity) {
    if (in_array(ClassUtils::getRealClass($entity), $this->securityClasses, true)) {
    if(get_class($entity) == 'Oro\Bundle\UserBundle\Entity\User') {
    $att = $uow->getEntityChangeSet($entity);
    if(!array_key_exists('lastLogin', $att) && !array_key_exists('loginCount', $att) && count($att) === 2) {
    return true;
    return false;

    I also import Business Unit with a cli import command that create new BusinessUnit with the following code :

    public function addBusinessUnit($name, $business_unit_owner_id = null, $phone = null, $website = null, $email = null, $fax = null)
    $businessUnit = new BusinessUnit();



    return $businessUnit;

    I notice that the OwerTreeProvider cache was not clear when i import BusinessUnit through doctrine persist().
    So i also change the AbstractOwnerTreeProvider::ensureTreeLoaded() to be public instead of protected to call this method at the end of my Business Import Script.

    Should i make a pull request with theses two changes in the ORO code ?

    Thanks for your reply,


Viewing 7 replies - 1 through 7 (of 7 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top

You will be redirected to [title]. Would you like to continue?

Yes No

You will be redirected to [title]. Would you like to continue?

Yes No