Skip to main content

Questions tagged [orm]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer

Get the average price for product collection

If there's a way in Magento 2 to get the average price for a product collection. Or should I loop over the collection? Thanks
AboElnouR's user avatar
  • 213
5 votes
2 answers

using sql queries is good practice in magento 2

using SQL queries is good practice in Magento 2 over ORM which is best one to while customizing 1)Security 2)Speed ORM vs SQL queries which one giving Security and speed while ...
prabhakaran7's user avatar
  • 1,087
0 votes
3 answers

How to resolve the "Direct object instantiation (object of \Zend_Db_Expr) is discouraged in Magento 2"?

I am getting warning as "Direct object instantiation (object of \Zend_Db_Expr) is discouraged in Magento2" when I did MEQP2. Please anyone can help me to resolve this warning. I am getting ...
Kavya cheerala's user avatar
1 vote
1 answer

Magento 1.9.x ORM query to get past successful orders with specific billing street, city, state and zip

I need an ORM query to get all past successful orders with a specific billing street address, city, state and zip code? ie: $street = '999 west rd'; $city = 'my town'; $state = 'New York'; $zip = '...
Ryan's user avatar
  • 193
1 vote
0 answers

SQL Functions at magento

I need to write a question use Magento ORM applying functions at condition like this: SELECT * WHERE REPLACE(street, ' ', '') = 'Streetac'. I try using regular expressions but I have problem with ...
user59428's user avatar
3 votes
2 answers

Magento\Framework\Exception\NoSuchEntityException when updating products

I am Trying to update product programmatically magento2 Magento ver. 2.1.2 Hear is my code require 'vendor/autoload.php'; use Magento\Framework\App\Bootstrap; include('app/bootstrap.php'); $...
srinath madusanka's user avatar
1 vote
0 answers

Load products without category association

I've been looking for a way to load products without a category in Magento2. I'm working on a cleanup script that will automatically assign them to a relevant category, but at a loss implementing the ...
quickshiftin's user avatar
  • 1,416
4 votes
1 answer

How do I specify unique constraint for multiple columns in InstallSchema.php?

In the InstallSchema.php, I would like to add an unique contraint on a combination of column. In SQL, it would be done with this request: ALTER TABLE `linked_cities` ADD UNIQUE `unique_index`(`...
enrico69's user avatar
  • 515
2 votes
2 answers

What methods typically go in Model, Resource and Collection

I'm fairly new to Magento, coming from a Symfony/Laravel background. Magento's ORM implementation seems a bit confusing at first. Most resource/collection classes only seem to have a _construct() ...
shineability's user avatar
2 votes
1 answer

Magento 2: links between entities: best practices

I have a question regarding link between entities. Consider that a car is linked to a brand. The car entity will have a brand_Id attribute. Coming from the "Symfony universe", using the Doctrine ORM, ...
enrico69's user avatar
  • 515
-1 votes
1 answer

Is it possible to implement model inheritance in magento?

For example I have Question model and Reply model. Both of them have methods with same names and similar functionality like isDeclined, isSeen etc. As it already extends Mage_Core_Model_Abstract how ...
Ilja's user avatar
  • 1,268
1 vote
1 answer

Get order data by product id Magento 1.9

i want to get all data (order_id , Bill to Name , ship to Name , BaseGrandTotal , GrandTotal ,Status ) about order with the known of product ids Here is the sample of my code $ids=array(); ...
Mahmoud Abd El Samad's user avatar
13 votes
4 answers

How to get product collections by set of ids in magento 2?

I want something like the "IN CLAUSE" in MYSQL via magento2 ORM, for example: select * from product where id in (...) but by using getCollection in magento 2 to get something like this: $...
ali gh's user avatar
  • 731
0 votes
1 answer

Magento orm model and direct SQL query

I am little bit confuse. I am using magento orm basic like Mage::getModel('test/test') and I search that also use direct SQL query use for insert,update and delete so my question is which one is ...
Niraj Patel's user avatar
4 votes
2 answers

Magento 2 CRUD Models: Create and Update Time

I've created a Magento 2 CRUD/Abstract model that updates the following MySQL table. CREATE TABLE `pulsestorm_commercebug_log` ( `pulsestorm_commercebug_log_id` int(10) unsigned NOT NULL ...
Alana Storm's user avatar
  • 44.4k