SlideShare a Scribd company logo
1 of 4
Download to read offline
Utilization of Zend: An Ultimate Alternate For Intense Data
Processing
Magento development
Magento development company
Image source:
http://www.letsdiscussonline.com/wp-content/uploads/2016/12/Zend-Framework-Lets-Discus
s-Online.png
In Magento, sometimes there are cases where a lot of data processing needs to be complete
and using Magento models and resources is either too slow or too intensive for your solution.
When the Zend framework on which Magento is constructed upon jumps in. Normally, you can
write raw php/mysql functionality for your requirements, but if you wish to keep your code
clean and reusable, using Zend functionality is the way. ​Magento development company​ ​use
the Zend framework.
Solicitation like making feed generator or some other custom scripts that will be too substantial
if used with initializing Magento are quite often and can be accomplished by writing a shell
script (located in shell directory of Magento project root) which will be used only needed
resources to complete the task.
Let’s create the script backbone from Magento class Mage_Shell_Abstract that add Mage.php
needed for basic initialization project classes. Set up our class and its attributes needed for this
example. Create file called ​hello-example.php in ​our shell directory inside Magento project:
--------------------------------------------------------Code---------------------------------------------------------------
require_once​ ​'abstract.php'​;
class​ Hello_Custom_Script ​extends​ Mage_Shell_Abstract
{
​public​ ​$r​ ​=​ ​null​;
​public​ ​$c​ ​=​ ​null​;
​public​ ​$entityTypeId​ ​=​ ​null​;
​public​ ​$productTypeId​ ​=​ ​null​;
​public​ ​$tables​ ​=​ ​array​()​;
​public​ ​function​ _construct​()
​{
​/** @var Mage_Core_Model_Resource r */
​/** @var Varien_Db_Adapter_Interface c */
​// Init connection and tables
​$this​->​r​ ​=​ Mage​::​getSingleton​(​'core/resource'​)​;
​$this​->​c​ ​=
$this​->​r​->​getConnection​(​Mage_Core_Model_Resource​::​DEFAULT_WRITE_RESOURCE​)​;
​// Entity type for products
​$this​->​entityTypeId​ ​=​ Mage​::​getModel​(​'eav/config'​)
​->​getEntityType​(​Mage_Catalog_Model_Product​::​ENTITY​)
​->​getEntityTypeId​()​;
​// Product type ID
​$this​->​productTypeId​ ​=​ Mage_Catalog_Model_Product_Type​::​TYPE_SIMPLE​;
​// Table names
​$this​->​tables​[​'cpe'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity'​)​;
​$this​->​tables​[​'ea'​]​ ​=​ ​$this​->​r​->​getTableName​(​'eav_attribute'​)​;
​$this​->​tables​[​'cpev'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity_varchar'​)​;
​$this​->​tables​[​'cped'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity_decimal'​)​;
​$this​->​tables​[​'cpei'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity_int'​)​;
​}
}
$script​ ​=​ ​new​ Hello_Custom_Script​()​;
$script​->​run​()​;
--------------------------------------------------------Code---------------------------------------------------------------
Call the function $this->c->select() initializes​ Varien_Db_Select.php ​which handles query build
with the help of ​Zend_Db_Select​. Inside​ app/code/core/Zend/Db/Select.php ​you run out of
memory, also you can wrap up sql call in a while loop and call results one by one.
With this result in slower execution but will not waste as much memory
--------------------------------------------------------Code---------------------------------------------------------------
public​ ​function​ run​()
​{
​$queryData​ ​=​ ​$this​->​c​->​select​()
​->​from​(
​array​(​'cpe'​ ​=>​ ​$this​->​tables​[​'cpe'​])​,
​array​(
​'ID'​ ​=>​ ​'cpe.entity_id'​,
​'SKU'​ ​=>​ ​'cpe.sku'
​)
​)
​// Join Name
​->​joinInner​(
​array​(​'ea'​ ​=>​ ​$this​->​tables​[​'ea'​])​,
​"ea.attribute_code = 'name' AND ea.entity_type_id = ​{$this->entityTypeId}​"​,
​null
​)
​->​joinLeft​(
​array​(​'cpev'​ ​=>​ ​$this​->​tables​[​'cpev'​])​,
​'cpev.attribute_id = ea.attribute_id AND cpev.entity_id = cpe.entity_id'​,
​array​(​'name'​ ​=>​ ​'cpev.value'​)
​)
​// Join Weight
​->​joinInner​(
​array​(​'ea1'​ ​=>​ ​$this​->​tables​[​'ea'​])​,
​"ea1.attribute_code = 'weight' AND ea1.entity_type_id = ​{$this->entityTypeId}​"​,
​null
​)
​->​joinLeft​(
​array​(​'cped'​ ​=>​ ​$this​->​tables​[​'cped'​])​,
​'cped.attribute_id = ea1.attribute_id AND cped.entity_id = cpe.entity_id'​,
​array​(​'weight'​ ​=>​ ​'cped.value'​)
​)
​// Join Status
​->​joinInner​(
​array​(​'ea2'​ ​=>​ ​$this​->​tables​[​'ea'​])​,
​"ea2.attribute_code = 'status' AND ea2.entity_type_id = ​{$this->entityTypeId}​"​,
​null
​)
​->​joinInner​(
​array​(​'cpei'​ ​=>​ ​$this​->​tables​[​'cpei'​])​,
​'cpei.attribute_id = ea2.attribute_id AND cpei.entity_id = cpe.entity_id'​,
​null
​)
​->​where​(​"cpei.value = 1 AND cpe.type_id = '​{$this->productTypeId}​'"​)
​->​limit​(​10​)​;
​$values​ ​=​ ​$this​->​c​->​query​(​$queryData​)​;
​$return​ ​=​ ​array​()​;
​while​(​$result​ ​=​ ​$values​->​fetch​())​ ​{
​// Do something with data here
​$return​[]​ ​=​ ​$result​;
​}
​return​ ​$return​;
​}
--------------------------------------------------------Code---------------------------------------------------------------
When everything is done you can call script from Magento root with ​php -f
shell/hello-example.php. ​Many ​Magento development ​company’s websites follow the Zend
framework.
Author bio:
Author -​Harshal Shah
Website -​ ​http://www.elsner.com/
Address-​305,306 Iscon Center,
Shivranjani Cross Road, Satellite,
Ahmedabad, India.
Phone number- ​+91 79 4006 2525

More Related Content

What's hot

Drupal Development
Drupal DevelopmentDrupal Development
Drupal DevelopmentJeff Eaton
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesNCCOMMS
 
Drupal 8: Forms
Drupal 8: FormsDrupal 8: Forms
Drupal 8: Formsdrubb
 
Building secured wordpress themes and plugins
Building secured wordpress themes and pluginsBuilding secured wordpress themes and plugins
Building secured wordpress themes and pluginsTikaram Bhandari
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Developmentipsitamishra
 
Drupal 8: Routing & More
Drupal 8: Routing & MoreDrupal 8: Routing & More
Drupal 8: Routing & Moredrubb
 
Django cheat sheet
Django cheat sheetDjango cheat sheet
Django cheat sheetLam Hoang
 
Pourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSPourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSThomas Gasc
 
How to migrate Cakephp 1.x to 2.x
How to migrate Cakephp 1.x to 2.xHow to migrate Cakephp 1.x to 2.x
How to migrate Cakephp 1.x to 2.xAndolasoft Inc
 
Drupal 8 Sample Module
Drupal 8 Sample ModuleDrupal 8 Sample Module
Drupal 8 Sample Moduledrubb
 
Using RequireJS with CakePHP
Using RequireJS with CakePHPUsing RequireJS with CakePHP
Using RequireJS with CakePHPStephen Young
 
Slimme Joomla! Templating Tips en Truuks
Slimme Joomla! Templating Tips en TruuksSlimme Joomla! Templating Tips en Truuks
Slimme Joomla! Templating Tips en TruuksThemePartner
 
Drupal 7 Entity & Entity API
Drupal 7 Entity & Entity APIDrupal 7 Entity & Entity API
Drupal 7 Entity & Entity API均民 戴
 
PHPConf-TW 2012 # Twig
PHPConf-TW 2012 # TwigPHPConf-TW 2012 # Twig
PHPConf-TW 2012 # TwigWake Liu
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin developmentMd. Ziaul Haq
 

What's hot (19)

Drupal Development
Drupal DevelopmentDrupal Development
Drupal Development
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_libraries
 
Php frameworks
Php frameworksPhp frameworks
Php frameworks
 
Drupal 8: Forms
Drupal 8: FormsDrupal 8: Forms
Drupal 8: Forms
 
Keeping It Simple
Keeping It SimpleKeeping It Simple
Keeping It Simple
 
Soa lab 3
Soa lab 3Soa lab 3
Soa lab 3
 
Code Igniter 2
Code Igniter 2Code Igniter 2
Code Igniter 2
 
Building secured wordpress themes and plugins
Building secured wordpress themes and pluginsBuilding secured wordpress themes and plugins
Building secured wordpress themes and plugins
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
 
Drupal 8: Routing & More
Drupal 8: Routing & MoreDrupal 8: Routing & More
Drupal 8: Routing & More
 
Django cheat sheet
Django cheat sheetDjango cheat sheet
Django cheat sheet
 
Pourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSPourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMS
 
How to migrate Cakephp 1.x to 2.x
How to migrate Cakephp 1.x to 2.xHow to migrate Cakephp 1.x to 2.x
How to migrate Cakephp 1.x to 2.x
 
Drupal 8 Sample Module
Drupal 8 Sample ModuleDrupal 8 Sample Module
Drupal 8 Sample Module
 
Using RequireJS with CakePHP
Using RequireJS with CakePHPUsing RequireJS with CakePHP
Using RequireJS with CakePHP
 
Slimme Joomla! Templating Tips en Truuks
Slimme Joomla! Templating Tips en TruuksSlimme Joomla! Templating Tips en Truuks
Slimme Joomla! Templating Tips en Truuks
 
Drupal 7 Entity & Entity API
Drupal 7 Entity & Entity APIDrupal 7 Entity & Entity API
Drupal 7 Entity & Entity API
 
PHPConf-TW 2012 # Twig
PHPConf-TW 2012 # TwigPHPConf-TW 2012 # Twig
PHPConf-TW 2012 # Twig
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin development
 

Similar to Utilization of zend an ultimate alternate for intense data processing

Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolGordon Forsythe
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalystsvilen.ivanov
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Phpfunkatron
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...LEDC 2016
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshopArjen Miedema
 
Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Compare Infobase Limited
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes ramakesavan
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
Disregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDisregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDaniel Cousineau
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entitiesdrubb
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Michelangelo van Dam
 
WooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda BagusWooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda BagusWordCamp Indonesia
 

Similar to Utilization of zend an ultimate alternate for intense data processing (20)

Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Introduction to Zend Framework
Introduction to Zend FrameworkIntroduction to Zend Framework
Introduction to Zend Framework
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Framework
FrameworkFramework
Framework
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshop
 
PHP MVC
PHP MVCPHP MVC
PHP MVC
 
Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
Disregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDisregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_Form
 
Zend Framework
Zend FrameworkZend Framework
Zend Framework
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entities
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
WooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda BagusWooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda Bagus
 
Django design-patterns
Django design-patternsDjango design-patterns
Django design-patterns
 

Recently uploaded

Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Servicecallgirls2057
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...lizamodels9
 
Organizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessOrganizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessSeta Wicaksana
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,noida100girls
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesKeppelCorporation
 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyotictsugar
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...ictsugar
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...lizamodels9
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Seta Wicaksana
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfpollardmorgan
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menzaictsugar
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMintel Group
 
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,noida100girls
 
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In.../:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...lizamodels9
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaoncallgirls2057
 
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...lizamodels9
 
Buy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy Verified Accounts
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis UsageNeil Kimberley
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Pereraictsugar
 

Recently uploaded (20)

Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
 
Organizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessOrganizational Structure Running A Successful Business
Organizational Structure Running A Successful Business
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation Slides
 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyot
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 Edition
 
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
 
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In.../:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
 
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
 
Buy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail Accounts
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Perera
 

Utilization of zend an ultimate alternate for intense data processing

  • 1. Utilization of Zend: An Ultimate Alternate For Intense Data Processing Magento development Magento development company Image source: http://www.letsdiscussonline.com/wp-content/uploads/2016/12/Zend-Framework-Lets-Discus s-Online.png In Magento, sometimes there are cases where a lot of data processing needs to be complete and using Magento models and resources is either too slow or too intensive for your solution. When the Zend framework on which Magento is constructed upon jumps in. Normally, you can write raw php/mysql functionality for your requirements, but if you wish to keep your code clean and reusable, using Zend functionality is the way. ​Magento development company​ ​use the Zend framework. Solicitation like making feed generator or some other custom scripts that will be too substantial if used with initializing Magento are quite often and can be accomplished by writing a shell script (located in shell directory of Magento project root) which will be used only needed resources to complete the task. Let’s create the script backbone from Magento class Mage_Shell_Abstract that add Mage.php needed for basic initialization project classes. Set up our class and its attributes needed for this example. Create file called ​hello-example.php in ​our shell directory inside Magento project: --------------------------------------------------------Code---------------------------------------------------------------
  • 2. require_once​ ​'abstract.php'​; class​ Hello_Custom_Script ​extends​ Mage_Shell_Abstract { ​public​ ​$r​ ​=​ ​null​; ​public​ ​$c​ ​=​ ​null​; ​public​ ​$entityTypeId​ ​=​ ​null​; ​public​ ​$productTypeId​ ​=​ ​null​; ​public​ ​$tables​ ​=​ ​array​()​; ​public​ ​function​ _construct​() ​{ ​/** @var Mage_Core_Model_Resource r */ ​/** @var Varien_Db_Adapter_Interface c */ ​// Init connection and tables ​$this​->​r​ ​=​ Mage​::​getSingleton​(​'core/resource'​)​; ​$this​->​c​ ​= $this​->​r​->​getConnection​(​Mage_Core_Model_Resource​::​DEFAULT_WRITE_RESOURCE​)​; ​// Entity type for products ​$this​->​entityTypeId​ ​=​ Mage​::​getModel​(​'eav/config'​) ​->​getEntityType​(​Mage_Catalog_Model_Product​::​ENTITY​) ​->​getEntityTypeId​()​; ​// Product type ID ​$this​->​productTypeId​ ​=​ Mage_Catalog_Model_Product_Type​::​TYPE_SIMPLE​; ​// Table names ​$this​->​tables​[​'cpe'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity'​)​; ​$this​->​tables​[​'ea'​]​ ​=​ ​$this​->​r​->​getTableName​(​'eav_attribute'​)​; ​$this​->​tables​[​'cpev'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity_varchar'​)​; ​$this​->​tables​[​'cped'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity_decimal'​)​; ​$this​->​tables​[​'cpei'​]​ ​=​ ​$this​->​r​->​getTableName​(​'catalog_product_entity_int'​)​; ​} } $script​ ​=​ ​new​ Hello_Custom_Script​()​; $script​->​run​()​; --------------------------------------------------------Code--------------------------------------------------------------- Call the function $this->c->select() initializes​ Varien_Db_Select.php ​which handles query build with the help of ​Zend_Db_Select​. Inside​ app/code/core/Zend/Db/Select.php ​you run out of memory, also you can wrap up sql call in a while loop and call results one by one. With this result in slower execution but will not waste as much memory
  • 3. --------------------------------------------------------Code--------------------------------------------------------------- public​ ​function​ run​() ​{ ​$queryData​ ​=​ ​$this​->​c​->​select​() ​->​from​( ​array​(​'cpe'​ ​=>​ ​$this​->​tables​[​'cpe'​])​, ​array​( ​'ID'​ ​=>​ ​'cpe.entity_id'​, ​'SKU'​ ​=>​ ​'cpe.sku' ​) ​) ​// Join Name ​->​joinInner​( ​array​(​'ea'​ ​=>​ ​$this​->​tables​[​'ea'​])​, ​"ea.attribute_code = 'name' AND ea.entity_type_id = ​{$this->entityTypeId}​"​, ​null ​) ​->​joinLeft​( ​array​(​'cpev'​ ​=>​ ​$this​->​tables​[​'cpev'​])​, ​'cpev.attribute_id = ea.attribute_id AND cpev.entity_id = cpe.entity_id'​, ​array​(​'name'​ ​=>​ ​'cpev.value'​) ​) ​// Join Weight ​->​joinInner​( ​array​(​'ea1'​ ​=>​ ​$this​->​tables​[​'ea'​])​, ​"ea1.attribute_code = 'weight' AND ea1.entity_type_id = ​{$this->entityTypeId}​"​, ​null ​) ​->​joinLeft​( ​array​(​'cped'​ ​=>​ ​$this​->​tables​[​'cped'​])​, ​'cped.attribute_id = ea1.attribute_id AND cped.entity_id = cpe.entity_id'​, ​array​(​'weight'​ ​=>​ ​'cped.value'​) ​) ​// Join Status ​->​joinInner​( ​array​(​'ea2'​ ​=>​ ​$this​->​tables​[​'ea'​])​, ​"ea2.attribute_code = 'status' AND ea2.entity_type_id = ​{$this->entityTypeId}​"​, ​null ​) ​->​joinInner​( ​array​(​'cpei'​ ​=>​ ​$this​->​tables​[​'cpei'​])​, ​'cpei.attribute_id = ea2.attribute_id AND cpei.entity_id = cpe.entity_id'​, ​null ​) ​->​where​(​"cpei.value = 1 AND cpe.type_id = '​{$this->productTypeId}​'"​) ​->​limit​(​10​)​; ​$values​ ​=​ ​$this​->​c​->​query​(​$queryData​)​; ​$return​ ​=​ ​array​()​;
  • 4. ​while​(​$result​ ​=​ ​$values​->​fetch​())​ ​{ ​// Do something with data here ​$return​[]​ ​=​ ​$result​; ​} ​return​ ​$return​; ​} --------------------------------------------------------Code--------------------------------------------------------------- When everything is done you can call script from Magento root with ​php -f shell/hello-example.php. ​Many ​Magento development ​company’s websites follow the Zend framework. Author bio: Author -​Harshal Shah Website -​ ​http://www.elsner.com/ Address-​305,306 Iscon Center, Shivranjani Cross Road, Satellite, Ahmedabad, India. Phone number- ​+91 79 4006 2525