OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums OroCRM Create Workflow via bin/console oro:workflow:definition: Entity not Available

This topic contains 13 replies, has 2 voices, and was last updated by Ilya Antypenko Ilya Antypenko 1 week, 2 days ago.

  • Creator
    Topic
  • #39000

    Frank
    Participant

    Hi there,

    I am trying to get Workflow-Demo-Example into work:
    https://github.com/oroinc/platform/blob/master/src/Oro/Bundle/WorkflowBundle/Resources/doc/reference/workflow/configuration-reference.md#example-workflow-configuration

    1)
    I created a new bundle, and enabled it (checked with Web-Profiler)

    2)
    Within this Bundle, I created two new entities (according to the DemoExample-description above):
    Acme\Bundle\DemoWorkflowBundle\Entity\PhoneCall.php
    Acme\Bundle\DemoWorkflowBundle\Entity\PhoneConversation.php

    3)
    I coded 2 migrations manually (as described in
    https://oroinc.com/orocrm/doc/current/dev-guide/entities/creating-entities):

    Acme\Bundle\DemoWorkflowBundle\Migrations\Schema\v1_0\PhoneCall.php, and
    Acme\Bundle\DemoWorkflowBundle\Migrations\Schema\v1_0\PhoneConversation.php

    4)
    The migrations were migrated with

    RESULT:
    Tabled are created in the right way (checked with phpMyAdmin)

    5)
    Workflow config-files were put into my Bundle directory (again, as described in the DemoWorkflow-example, see link on the top of this thread):
    Acme\Bundle\DemoWorkflowBundle\Resources\config\oro\workflows.yml
    Acme\Bundle\DemoWorkflowBundle\Resources\translations\workflows.en.yml

    6)
    Workflow was load, with:

    RESULTS:
    – Workflow was loaded. It shows up in the list of available workflows (Backend > System > Workflows …)
    with its name,
    and related entity: Acme\Bundle\DemoWorkflowBundle\Entity\PhoneCall

    QUESTION 1:
    – In the single Workflow view shown things, RELATED ENTITY is NOT AVAILABLE
    – Looking into the list of available entities via Backend > system > Entities > Entitymanager, both new entities PhoneCall and PhoneConversation are not listed.
    What is going on here?

    QUESTION 2:
    In workflows.yml
    init_entities are set to:
    – ‘Oro\Bundle\UserBundle\Entity\User’, and
    – ‘Oro\Bundle\TaskBundle\Entity\Task’

    Trying to test the workflow from
    – Backend > System > Users > [some single user], or
    – Backend > System > Tasks > [some single task]
    It shows some workflows buttons, however, they are not clickable, and labels are, like
    ‘oro.workflow.phone_call.transisition.start_call.label’

    It should be clickable at first, and should be labeled correctly with
    ‘Start Phone Call’
    as configured in workflows.en.yml.

    Message Consumers are running (checked)!

    What is wrong with ENTITIES and WORKFLOW-Labels here?

    Thanks a lot for urgent help
    Frank

Viewing 13 replies - 1 through 13 (of 13 total)
  • Author
    Replies
  • #39001

    Frank
    Participant

    This is, how the translation config file workflows.en.yml lookes like:

    #39002

    Frank
    Participant

    And, this is workflows.yml config file, last not least.

    #39013
    Ilya Antypenko
    Ilya Antypenko
    Participant

    Hi Frank.

    > QUESTION 1:

    Please check that you run bin/console cache:clear --env=prod to clear caches for production environment (CLI commands run in dev env, when web requests are handled in prod env by default)

    > QUESTION 2:
    > like ‘oro.workflow.phone_call.transisition.start_call.label’

    You need to create translation for this button.
    Something like this: https://github.com/oroinc/orocommerce/blob/c2bc3f4257f6d3bc60eded141d0041dd1b882fe0/src/Oro/Bundle/CheckoutBundle/Resources/translations/workflows.en.yml#L8

    I don’t see key you mentioned here in your workflows.en.yml file. Please check it.
    I see that you have start_call.label in step section, but you need to have it in transition section as well

    > It shows some workflows buttons, however, they are not clickable, and labels are, like

    Verify that your role has permissions to interact with this workflow.
    You can find this settings on the Roles view page in Workflows section

    #39016

    Frank
    Participant

    Hi Ian,

    thanks for reply.

    QUESTION 1:

    command
    bin/console cache:clear –env=prod

    does not work, unfortately. Entities have been migrated to mysql-db correctly, but they are not listed in
    backend > system > entities > manage entities.


    Creating other entities within my own bundles
    /src/Avme/DemoBundle/ …

    creates DB-tables as well, but entity is not listed in
    backend > system > entities > manage entities.

    What I am doing wrong?

    Thanks for help
    Frank

    #39019
    Ilya Antypenko
    Ilya Antypenko
    Participant

    Do your entities have @Config annotation?
    It’s needed to make this entity configurable and available from Entity Management UI.

    Please check documentation here:
    https://github.com/oroinc/platform/tree/1af2f879d74d52c8ff01cfbe93b0568b230ed362/src/Oro/Bundle/EntityConfigBundle#oroentityconfigbundle

    Example of usage:
    https://github.com/oroinc/OroCRMTaskBundle/blob/48622b405dce7c7288b8fb17afe1fb0bd249dc16/Entity/Task.php#L31

    #39020

    Frank
    Participant

    Hi Ilya,

    ok, this seems to be the right way …

    Yes, indeed, my entities have @config annotations, but the are ’empty’:

    It seems, I have to specify (=expand) @config annotation within Entity-class-definition as shown in your usage-example above ..?!


    OR, can I use ’empty’ @config annotation PLUS /oro/config/entity_config.yml
    in my bundle AS WELL?
    (Trying this second way, I wasn’t successful until now)

    Thanks a lot.
    Frank

    #39021

    Frank
    Participant

    Hi Ilya,

    doc is very helpful!!!! Thank you. I gonna read it first, think it will help to solve my problem.

    Kind regrads
    Frank

    #39023
    Ilya Antypenko
    Ilya Antypenko
    Participant

    You are welcome.

    Configuration in oro/config/entity_config.yml is used to create your own entity configs. As I understand it’s not what you want right now.

    Empty @Config() should be ok, just check that you have
    use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config; in your file.

    If it doesn’t help you. Please share your entity php file

    #39025

    Frank
    Participant

    Hi Ilya,

    I tried to define some config-parameters for a single Demo-Entity ‘Hotel’:

    After that I run CLI-command:
    $ ./bin/console oro:entity-config:update

    1.
    Good news: Entity shows up on Backend >System > Entities > Entity Manger

    2. Bad News: Column-label is not shown (translated) correctly:
    acme.demoentityconfig.hotel.entity_label insted of ‘Hotel’, or ‘XHotels’

    Debugging with:
    $ ./bin/console oro:entity-config:debug “Acme\Bundle\DemoEntityConfigBundle\Entity\Hotel”

    results in console-output:

    Questions:

    I. Should I ‘translate’ label instead trying to set it with @config() ? How a translation could look like (path/filename + sample configuration – thanks a lot!)?

    II. “entity_label” is not the right parameter for column-label configuration in data-grid, obviously. However I failed in deleting/overwriting it! How I can remove a parameter, set previously?

    Of course, I deleted the cache:

    Config Debug results always in the same:

    But I would expect:

    #39027

    Frank
    Participant

    Hi Ilya,

    found a/(the?) solution, and it is really crazy:

    I have to delete entity-attributes first, and update config then:

    [B] stands for: “Acme\Bundle\DemoEntityConfigBundle\Entity\Hotel”

    After them only, framework is free to accept:

    when I am running:
    $ ./bin/console oro:entity-config:update

    Now :)
    $ ./bin/console oro:entity-config:debug “Acme\Bundle\DemoEntityConfigBundle\Entity\Hotel”

    outputs to the screen

    And in Backend > System > Entities > Entity-Management
    The correct column-‘label’ is displayed in data-grid-table.


    BUT :-(
    in single entity-view: Backend > System > Entities > Entity-Manager > Click on AcmeHotel-label > Open ‘Entity / AcmeHotel’-page
    Label – is not available
    Plural-Label – is not available

    It seems, some translation is still needed, but where (whith use of which yml-file), and how to setup nodes / keys /values there?

    I did not found any documentation, which would be helpful for that!

    Thank you.

    KR
    Frank

    #39028

    Frank
    Participant

    It becomes MORE CRAZY:

    In single entity-view: Backend > System > Entities > Entity-Manager > Click on AcmeHotel-label > Open ‘Entity / AcmeHotel’-page > Update

    I can assign a new ‘label’ > AHX, ‘plural-label’ > AHXs , ‘description’ > Wellness and Sea …

    After saving those values, they are stored somewhere, and opening the entity-page in entity-manager again, those values are displayed again …

    HOWEVER, debugging with:
    $ ./bin/console oro:entity-config:debug “Acme\Bundle\DemoEntityConfigBundle\Entity\Hotel”

    shows my old values:

    2 independent ways (Backend Entity-Manager /defining @config() in Entity-PHP-Class) to update the same attributes, but stored in different places in the DB????? Can’t believe this!

    Thanks for explanation.
    Frank

    #39032

    Frank
    Participant

    I ‘ve got it, finally (file names, path … are from my demo example):

    1. Create PHP-Class to define entity, setting @config() in PHP-Doc.
    Set attributes only, which are not defined by default:
    I have set one attribute “icon”=”fa-home”, which is not default, and
    I have NOT set “label”, “plural_label”, and “description”, which are defined by default

    See OroDoc:
    https://github.com/oroinc/platform/tree/1af2f879d74d52c8ff01cfbe93b0568b230ed362/src/Oro/Bundle/EntityConfigBundle#oroentityconfigbundle

    See use case:
    https://github.com/oroinc/OroCRMTaskBundle/blob/48622b405dce7c7288b8fb17afe1fb0bd249dc16/Entity/Task.php

    2. Create Migration (some PHP-class to updaten DB-schema):
    To do this half-automated, I have dumped migration schema by using console-command:

    … copied the output,and pasted it to PHP-migration-class:
    src/Acme/Bundle/DemoEntityConfigBundleMigrations/Schema/v1_0/Hotel.php

    3. Load migration:

    4. Translate Entity-Labels:
    create: scr/Acme/Bundle/DemoEntityConfigBundle/Resources/translations/messages.en.yml

    See OroDoc: > Standard Symfony Translator
    https://oroinc.com/oroplatform/doc/current/dev-guide/translations

    See use case:
    https://github.com/oroinc/OroCRMTaskBundle/blob/48622b405dce7c7288b8fb17afe1fb0bd249dc16/Resources/translations/messages.en.yml

    5. Run Entity-config update

    Cache-clearing may be helpful:

    6. Check results:
    a) Output current entity-config (translations are not shown, of course):

    Output helps to address correct attributes for entity-definition (@config step 1), and identifying correct attribute keys for translations (step 4).

    b) Last not least, check entity-availabilty and correct label-translations in admin-UI via:
    backend > System > Entities > Entity Manger
    backend > System > Entities > Entity Manager > click on/open ‘THotel’- entity

    From backend admin can update Hotel-entity. This will overwrite translations in messages.en.yml.
    Once you want to remove those UI-defined entity-attributes, you have to remove them from the console via command (for example remove the UI-defined ‘description’), [Bundle] is the placeholder for “Acme\Bundle\DemoEntityConfigBundle\Entity\Hotel”:

    That’s it. May be it’s helpful for someone. Thank Ilja for help!
    Frank

    #39041
    Ilya Antypenko
    Ilya Antypenko
    Participant

    Glad to see that you’ve resolved you issue.

    JFI configuration in php class is “default”. And this default information is loading to the DB during oro:entity-config:update or install process.

    If you just remove this configuration form php file it still will be in DB.

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

You must be logged in to reply to this topic.

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

Yes No