enriquepiatti / Magicento

PHPStorm plugin for Magento developers
115 stars 35 forks source link

[Magento2] Object manager return types not resolved propertly #238

Closed Koc closed 7 years ago

Koc commented 7 years ago
$category = $this->_objectManager->create('Magento\Catalog\Model\Category');
$category->load($categoryId);
// type of category variable not resolved, no any autocomplete or ctrl+click
enriquepiatti commented 7 years ago

solved, will be available in next version (1.5+) Thanks!!

Koc commented 7 years ago

@enriquepiatti awesome, helps a lot, thank you! One small thing: it doesn't work with class constant:

$parentId = $this->objectManager
    ->create('Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable')
    ->getParentIdsByChild($product->getId()); // type resolved

$parentId = $this->objectManager
    ->create(\Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable:class)
    ->getParentIdsByChild($product->getId()); // unknown type
enriquepiatti commented 7 years ago

added support for that too (available in next release 1.6+)