View Single Post
  #2  
Old 08-07-2017, 07:47 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: How to get data from other databases?

X-Cart 5 uses Doctrine library to work with the database. Although it works with its own tables via the ORM part of the library, you still can execute raw SQL queries over database tables created by other applications - see the documentation on createNativeQuery() method there:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/native-sql.html

To get the entity manager that works with the XC5's database, do this:
PHP Code:
$entityManager = \XLite\Core\Database::getEM(); 

To work with other databases (created by other web applications) you can create custom "entity managers" - check how X-Cart 5 creates its own entity manager in \XLite\Core\Database::startEntityManager() method.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote