MagentoBundle
This project is a bridge between Symfony 2 and Magento-Client API which allow to call easily the Magento Soap v1 API.
Allows :
- wrappers for each call
- dependencies injections
- event listeners
- debug toolbar integration
- and ... code completion
Requirements
- Symfony >= 2.1
- PHP >= 5.3
- smalot/magento-client
Installation
Add the following lines to your composer.json:
{
"require": {
"smalot/magento-bundle": "*"
}
}
And run php composer.phar update smalot/magento-bundle
Then, register the bundle in your kernel:
# app/AppKernel.php
# ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
# ...
new Smalot\MagentoBundle\MagentoBundle(),
);
return $bundles;
}
}
Configuration
You need to setup at least one connection in the connections
pool and specify it with the default_connection
property.
The mandatory properties are: url
, api_user
and api_key
.
# app/config/config.yml
# Sample configuration
magento:
# Refers to the default connection in the connection pool
default_connection: default # Example: default
# List all available connections
connections:
# Prototype
default:
url: http://domain.tld/magento/
api_user: username
api_key: 0123456789AZ
# Enable logging system
logging: %kernel.debug%
# Refers to the logger service
logger: ~
# Refers to the dispatcher service
dispatcher: ~
Details
Service(s) provided:
- magento
Events thrown in security context:
- \Smalot\MagentoBundle\MagentoEvents::PRE_LOGIN
- \Smalot\MagentoBundle\MagentoEvents::POST_LOGIN
- \Smalot\MagentoBundle\MagentoEvents::PRE_LOGOUT
- \Smalot\MagentoBundle\MagentoEvents::POST_LOGOUT
Events thrown in transport context:
- \Smalot\MagentoBundle\MagentoEvents::PRE_SINGLE_CALL
- \Smalot\MagentoBundle\MagentoEvents::POST_SINGLE_CALL
- \Smalot\MagentoBundle\MagentoEvents::PRE_MULTI_CALL
- \Smalot\MagentoBundle\MagentoEvents::POST_MULTI_CALL
Sample codes
Using the default
connection:
```php
class MagentoController extends Controller
{
/**
* @Route("/", name="magento_index")
*/
public function indexAction(Request $request)
{
// Retrieve default connection.
$magento = $this->get('magento')->getManager();
if ($magento->ping()) {
// Call any module's class.
$categoryManager = new \Smalot\Magento\Catalog\Category($magento);
$tree = $categoryManager->getTree()->execute();
} else {
$tree = array();
}
$magento->logout();
return new Response('<html><body><pre>' . var_export($tree, true) . '</pre></body></html>');
}
}
```
The connection can be specified manually if needed:
$magento = $this->get('magento')->getManager('second_connection_name');
Copyright (c) 2014 Sebastien MALOT <sebastien@malot.fr>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-
Merge pull request #4 from talisman-innovations/master
By web-flow, 1 year ago
-
Remove deprecation
By , 1 year ago
-
Only depends on symfony framework
By stevenbrookes, 1 year ago
-
Update to symfomny 4.0
By stevenbrookes, 1 year ago
-
Add reset() to remove symfony 3.4 deprecation notice
By stevenbrookes, 2 years ago
-
Merge pull request #5 from mediact/hotfix/symfony-3-support
By web-flow, 4 years ago
-
Merge remote-tracking branch 'origin/master' into hotfix/symfony-3-support
By ksangers, 4 years ago
-
Added composer.lock to the gitignore
By ksangers, 4 years ago
-
Corrected parameter and service references
By ksangers, 4 years ago
-
Removed extension of ContainerAware; added implementation of ContainerAwareInterface
By ksangers, 4 years ago
-
Corrected dependencies
By ksangers, 4 years ago
-
Merge pull request #2 from mmenozzi/patch-1
By web-flow, 4 years ago
-
Fixes deprecation notices in Symfony 2.8
By web-flow, 4 years ago
-
Update README.md
By smalot, 6 years ago
-
Merge pull request #1 from freelancer37/patch-1
By smalot, 6 years ago
-
Update README.md
By Olivier Soulet, 6 years ago
-
Update README.md
By smalot, 6 years ago
-
update readme.md
By smalot, 6 years ago
-
code refactoring
By smalot, 6 years ago
-
code refactoring
By smalot, 6 years ago
-
code cleaning
By smalot, 6 years ago
-
rewrite part of code
By smalot, 6 years ago
-
maj readme
By smalot, 6 years ago
-
maj readme
By smalot, 6 years ago
-
maj readme file
By smalot, 6 years ago
-
main developments
By smalot, 6 years ago
-
Initial commit
By smalot, 6 years ago