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.
- CreatorTopic
- August 9, 2019 at 5:32 am #40166
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.
- CreatorTopic
- AuthorReplies
- August 9, 2019 at 8:27 am #40167
Oro Plugin depends on a Symfony PhpStorm plugin. Make sure you have the Symfony plugin enabled and configured properly.
August 9, 2019 at 9:01 am #40168Hi 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
August 9, 2019 at 9:25 am #40169Also please check that the dev environment cache exists in var/cache directory as plugin relying on it afaik.
August 10, 2019 at 4:08 am #40174Good 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!):
PHP1https://oroinc.com/orocrm/doc/current/dev-guide/entities/adding-propertiesPHP1234567891011121314151617181920212223242526272829303132333435363738394041<?phpnamespace MyShoppingListBundle\Migrations\Schema\v1_1;use Doctrine\DBAL\Schema\Schema;use Oro\Bundle\EntityBundle\EntityConfig\DatagridScope;use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;use Oro\Bundle\MigrationBundle\Migration\Migration;use Oro\Bundle\MigrationBundle\Migration\QueryBag;/*** Class OroShoppingListBundle* @package MyShoppingListBundle\Migrations\Schema\v1_1**/class AddBuOwnerToShoppingList implements Migration{/*** @param Schema $schema* @param QueryBag $queries* @throws \Doctrine\DBAL\Schema\SchemaException*/public function up(Schema $schema, QueryBag $queries){$table = $schema->getTable('oro_shopping_list');$table->addColumn('buOwner','text',['oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM],'datagrid' => ['is_visible' => DatagridScope::IS_VISIBLE_TRUE],'merge' => ['display' => true],]]);}}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.phpYes, 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):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 ofTEXT
or BLOB or those belong toTEXT
orBLOB
types such asTINYBLOB
,MEDIUMBLOB
,LONGBLOB
,TINYTEXT
,MEDIUMTEXT
, andLONGTEXT
that you try to make a primary key or index. With fullBLOB
orTEXT
without the length value, MySQL is unable to guarantee the uniqueness of the column as it’s of variable and dynamic size. So, when usingBLOB
orTEXT
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 onTEXT
orBLOB
.TEXT(88)
simply won’t work.”STEP 3 (solution)
—
I modified my migration as follows:PHP123456789101112131415161718192021222324252627282930313233343536373839404142<?phpnamespace MyShoppingListBundle\Migrations\Schema\v1_2;use Doctrine\DBAL\Schema\Schema;use Oro\Bundle\EntityBundle\EntityConfig\DatagridScope;use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;use Oro\Bundle\MigrationBundle\Migration\Migration;use Oro\Bundle\MigrationBundle\Migration\QueryBag;/*** Class OroShoppingListBundle* @package MyShoppingListBundle\Migrations\Schema\v1_2**/class AddBuOwnerToShoppingList implements Migration{/*** @param Schema $schema* @param QueryBag $queries* @throws \Doctrine\DBAL\Schema\SchemaException*/public function up(Schema $schema, QueryBag $queries){$table = $schema->getTable('oro_shopping_list');$table->addColumn('buOwner','string',['length' =>100,'oro_options' => ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM],'datagrid' => ['is_visible' => DatagridScope::IS_VISIBLE_TRUE],'merge' => ['display' => true],]]);}}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
- AuthorReplies
The forum ‘OroPlatform’ is closed to new topics and replies.