ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 14 replies, has 7 voices, and was last updated by Mike Kudelya Mike Kudelya 1 year, 1 month ago.

  • Creator
    Topic
  • #11274

    andesk
    Participant

    Hi there,

    we have been running into an issue, that the new “phone” attribute for User is not recognized in the application after upgrading OroPlatform from 1.3 to 1.7.0:

    Neither the property “phone” nor one of the methods “getPhone()”, “isPhone()”, “hasPhone()”, “__get()” exist and have public access in class “Oro\Bundle\UserBundle\Entity\User”.

    The field was added to oro_user table in mysql though.

    After some investigation we *think* the reason might be, that this field is not “registered” in oro_entity_config_field table. On local dev environment and also on a dedicated testing environment, this field exists (on those environments we do not get the error message), on production it does not. Investigating deeper showed that several other fields are missing as well and on the other hand, several fields exist on production that do not exist on freshly setup dev environment.

    Is there a chance to fix this and if so, how? We checked the documentation regarding EntityConfigBundle, EntityExtendBundle etc and also tried running some of the commands (after database backup of course), e.g. oro:entity-config:debug (but there was no output of fields at all? seems to be “broken”?), but did not succeed. Is there any advice how to cleanup and update the entity configuration in the database?

    Thanks for help,
    Andes

Viewing 14 replies - 1 through 14 (of 14 total)
  • Author
    Replies
  • #11561

    andesk
    Participant

    Hmm. Anyone?

    Any further information needed? Is the issue described clearly enough?

    It seems like something like this *might* happen to others as well, so it would be great to find a way out of this 🙂

    Thanks for help!

    #11562

    cardiac
    Participant

    Happend to me http://www.orocrm.com/forums/topic/nosuchpropertyexception-user-phone
    Exact same issue and no reply yet.

    #11563

    cardiac
    Participant

    Digging deeper:

    Error Env:

    Working Env:

    Looks like the database is missing something.

    Error Env:

    Working Env:
    MariaDB [orocrm_dev]> select count(*) from oro_entity_config_field where entity_id = 9;
    +----------+
    | count(*) |
    +----------+
    | 34 |
    +----------+
    1 row in set (0.00 sec)

    MariaDB [orocrm_prod]> select count(*) from oro_entity_config_field where entity_id = 9;
    +----------+
    | count(*) |
    +----------+
    | 5 |
    +----------+
    1 row in set (0.00 sec)

    #11565

    cardiac
    Participant

    My fix:

    insert into oro_entity_config_field (entity_id, field_name, type, created, updated, mode, data) VALUES (7, 'phone', 'string', '2015-06-30 07:37:16', '2015-06-30 07:37:19', 'default', 'YTo3OntzOjU6ImVtYWlsIjthOjE6e3M6MjE6ImF2YWlsYWJsZV9pbl90ZW1wbGF0ZSI7YjoxO31zOjY6ImVudGl0eSI7YToyOntzOjU6ImxhYmVsIjtzOjIwOiJvcm8udXNlci5waG9uZS5sYWJlbCI7czoxMToiZGVzY3JpcHRpb24iO3M6MjY6Im9yby51c2VyLnBob25lLmRlc2NyaXB0aW9uIjt9czo4OiJkYXRhZ3JpZCI7YToxOntzOjEwOiJpc192aXNpYmxlIjtiOjE7fXM6NDoiZm9ybSI7YToxOntzOjEwOiJpc19lbmFibGVkIjtiOjE7fXM6NDoidmlldyI7YToxOntzOjE0OiJpc19kaXNwbGF5YWJsZSI7YjoxO31zOjY6ImV4dGVuZCI7YTo2OntzOjU6Im93bmVyIjtzOjY6IlN5c3RlbSI7czo1OiJzdGF0ZSI7czo2OiJBY3RpdmUiO3M6OToiaXNfZXh0ZW5kIjtiOjE7czo2OiJsZW5ndGgiO2k6MjU1O3M6MTA6ImlzX2RlbGV0ZWQiO2I6MDtzOjY6Im9yaWdpbiI7czo2OiJTeXN0ZW0iO31zOjk6ImRhdGFhdWRpdCI7YToxOntzOjk6ImF1ZGl0YWJsZSI7YjoxO319')

    entity_id is for User class from table oro_entity_config.

    But there has to be a general solution by code. Shouldn’t be this hacky!

    PS: Thank you andesk for giving me the hint I needed to solve this.

    #11642

    andesk
    Participant

    Hi cardiac,

    great that my investigation was helpful to you!

    I also think that there should be some command or whatever that at least should identify out-of-sync data in field configuration in database. Fixing that would of course be a lot better. I am not even sure if this already exists but isn’t communicated clear enough in the documentation…

    Any Core developer reading this: would be great to get some info regarding the topic 😉

    #11890

    andesk
    Participant

    Hmm. I am still in the need of some information regarding this topic. How to verify/guarantee/fix field configuration of entities?

    Anyone?

    #12052

    hurricane
    Oro Core

    Hello @andesk,

    Unfortunately I cannot reproduce the problem, when I try to migrate from platform version 1.6.0 to 1.7.3 I did the following steps:
    1. Checkout https://github.com/orocrm/platform version 1.6.0
    2. Do composer update
    3. Do app/console oro:install –env=prod –force
    4. Checkout https://github.com/orocrm/platform version 1.7.3
    5. Do composer update
    6. Remove prod cache
    7. Do app/console oro:platform:update –env=prod –force

    All looks ok, the phone field has been successfully created.

    Could you please confirm that you did the same things and the problem is still reproduced?
    And could you please provide us the list of applied migrations?

    #12114

    andesk
    Participant

    Hello hurricane,

    thank you for testing this! As I wrote it happened somewhere in upgrade path from 1.3.0 to 1.7.0. I did not try to identify the exact version where the issue occurs.

    What I am interested in is the management of entity fields data in the database and how to clean it, update it and so on. As I wrote and cardiac also verified is, that it seems to happen that these data sets get out of sync somehow.

    I am quite sure that just deleting all entries will not fix the issue here, so I was curious if there is a way to fix it. What I thought of, but did not try to reproduce is to do a clean install on a dev environment and then dump/”sync” the entity_config tables to test/production servers, but I guess this is not the right way to do it…

    #12629

    andesk
    Participant

    Dear core devs,

    is there any chance to get a response?

    I see two possibilities for current status of this post:
    – no core dev has read this so far
    – the answer is simply “outch, we do not have a solution here”

    I can live with that second possibility, but at the moment I am just unsure, how to proceed with the situation…

    #12636

    Vova Soroka
    Oro Core

    Hello @andesk,

    You are right, we do not have a solution to remove data from tables with entity config information, especially in case if some relation is removed. It is known issue and we have a task in our roadmap to create a migration extension which will solve this.
    Changing entity (and field) configuration is possible right now. For example you can find a sample in a migration of OroCalendarBundle:
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/CalendarBundle/Migrations/Schema/v1_3/OroCalendarBundle.php#L124-L132

    If you need to remove some data from entity config related tables, you can use native SQL queries in migrations, but take into account that it is a workaround. An example of such query you can find in OroEmailBundle:
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/EmailBundle/Migrations/Schema/v1_2/UpdateAvailableInTemplateQuery.php

    #13214

    andesk
    Participant

    Late thank you for the reply (was on vacation since Aug 25th)!

    At least we know now that currently native sql is the way to handle inconsistencies.

    Still weird how they were introduced at all because we just followed same upgrade instructions…

    #16586

    Calin Pristavu
    Participant

    Hey there,

    I have encountered the same problem, but with a fresh install of 1.9.0 (but obviously, I posted in the wrong topic, sorry for that).

    here’s the description: comment

    #16592

    Hi,
    Could you describe environment (php, sql, etс)? It will help us to determine the cause

    #20570
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi @andesk,

    Did you try completely remove /app/cache/dev and /app/cache/prod directories and run this command?

    After that does app/cache/[env]/oro_entities/Extend/Entity/EX_OroUserBundle_User.php contain $phone variable and getPhone, setPhone methods ?

    where [env] is our environment.

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

You must be logged in to reply to this topic.