OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform oro PhpStorm Plugin: does not list/suggest/inspect EX_entity dev-cache-classes

This topic contains 4 replies, has 2 voices, and was last updated by  Frank 4 years, 8 months ago.

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

  • Creator
    Topic
  • #40166

    Frank
    Participant

    Simple question, but I am spending a lot of time without finding a solution:

    Oro works with automatically generated entity-extended cache-classes like

    EX_OroCustomerBundle_customerVisitor.php.

    Using the oro phpStorm plugin, phpStorm detects those classes with its methods, and suggests not only basic OroBundle-entity-class, but although the dev-cache-entity-extended class ‘EX_ …’.

    I have one phpStorm project with perfect working plugin. However in another new fresh project of the same phpStorm-instance, and same oro commerce version 3.1.x the oro plugin does not work at all.

    Plugin is enabled (one can enable/disable it for all projects of an phpStorm instance only), and I did not find any differences between the 2 projects.

    Is there anybody from oro-dev-team, who has got the same experience, and may be found a solution … ?

    Would be great!

    Thank you.

    Frank.

     

     

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #40167

    Andrey Yatsenko
    Moderator

    Oro Plugin depends on a Symfony PhpStorm plugin. Make sure you have the Symfony plugin enabled and configured properly.

    #40168

    Frank
    Participant

    Hi Andrey,

    thank for your fast reply.

    No, Symfony plugin is on place, and configuration has been checked (at least it is the same as the working version …).

    It is strange:

    I have extended shoppingList-Entity via Migrations with custom field buOwner (businessOwner) … as an alternative to serializedFieldsExtension.

    Ex_OroShoppingList_ShoppingList.php – class has been created in dev-cache, with setBuOwner() and getBuOwner() working like a clockwork (behind the inspection …)..

    However if I create a new ShoppingList(), I can set $shoppingList->setBuOwner($str), and it is stored in db, finally. But IDE suggestion is not working. ->setBuOwner is not listed as a suggestion.

    If I use mouseover for inspection,
    $shoppingList = new  ShoppingList(),
    phpStorm says, that this is a OroShoppingListBundle/…/ShoppingList-object,
    but it should say that it is an EX_OroShoppingList_ShoppingList-object.

    It is the same behaviour in OroCoreBundle, or myCustomBundle.

    And in another mirrowed project, it works fine.

    No idea, what should I do. Inspection shows errors (missing methods … and more), but those errors are not corresponding to reality.

    It is very confusing!!!!

    Thanks for a hint.

    Frank

     

    #40169

    Andrey Yatsenko
    Moderator

    Also please check that the dev environment cache exists in var/cache directory as plugin relying on it afaik.

    #40174

    Frank
    Participant

    Good morning,

    thank you Andrey, staying with me …!

    Found the error!

    It is not related to phpStorm itself, but listen:

    STEP 1:

    In order to extend ShoppingList-entity with custom property buOwner (business owner) i have put a migration like:

    As it was recommended by ( DO NOT USE THIS GUIDE for other reasons as well, IT IS OUTDATED!):

    I carried out console command:

    $ sudo -u nginx php ./bin/console oro:migraton:load –force

    which goes through without any error message.

    I have checked for presense of:
    oroapp/var/cache/dev/oro_entities/Extend/Entity/EX_OroShoppingListBundle_ShoppingList.php

    Yes, it was there.

    Full functionality was given, but phpStorm-inspection did not work (which can be very confusing, as described above).

    STEP 2:

    As described  in (USE THIS GUIDE to extend an oro-core-entity with your custom property):

    https://github.com/oroinc/platform/tree/master/src/Oro/Bundle/EntityExtendBundle#modify-entities-using-migration-scripts

    i started console commands:

    S php bin/console oro:entity-extend:update-config
    which goes throug, and

    $ php bin/console oro:entity-extend:update:schema
    which put a huge error out:

    BUOWNER: KEY SPECIFICATION WITHOUT LENGTH!

    I found a very helpful discussion on that on stackoverflow:
    https://stackoverflow.com/questions/1827063/mysql-error-key-specification-without-a-key-length

    “The error happens because MySQL can index only the first N chars of a BLOB or TEXT column. So The error mainly happens when there is a field/column type of TEXT or BLOB or those belong to TEXT or BLOB types such as TINYBLOBMEDIUMBLOBLONGBLOBTINYTEXTMEDIUMTEXT, and LONGTEXT that you try to make a primary key or index. With full BLOB or TEXT without the length value, MySQL is unable to guarantee the uniqueness of the column as it’s of variable and dynamic size. So, when using BLOB or TEXT types as an index, the value of N must be supplied so that MySQL can determine the key length. However, MySQL doesn’t support a key length limit on TEXTor BLOBTEXT(88) simply won’t work.”

    STEP 3 (solution)

    I modified my migration as follows:

    After appliing this, phpStorm recognizes all EX_OroBundle_ …-superclasses, and all is fine now!

    CONCLUSION:

    May be, it makes sense for OroDev-Team to adapt OroEntityExtendBundle and Oro-Platform-plugin for phpStorm, both in that way, that USING for custom property A KEY WITH LENGTH less then allowed (by mysql …) for indexing, will RESULT IN A CLEAR ERROR during oro:migration:load –force!

    Hope, this was helpful for other who is beginning to work with oro application.

    Kind regards from Germany

    Frank

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

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

Back to top