How to get data from other databases?
I plan to install drupal, wordpress, and using different databases for www.buyeyeglasses.net. How to get data from drupal 8, and wordpress 4.8, pls?
tks |
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:
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. |
Re: How to get data from other databases?
Actually, there is an easier method if you don't need the ORM functions:
http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/index.html Doctrine ORM works on top of Doctrine DBAL, so, in theory, you should be able to use it inside X-Cart 5 code too. However, I never tried this, and can't find examples in the source code of X-Cart 5. |
Re: How to get data from other databases?
www.buyeyeglasses.net is based on x-cart 4.7.8, not 5
|
Re: How to get data from other databases?
I don't understand the question then.
In X-Cart 4 there is no the abstract layer on top of MySQL - you work with "raw" SQL queries. How would you access any MySQL database from a custom PHP script? PDO? Do the same inside X-Cart 4 scripts. Or do you face any specific problems with this method? |
All times are GMT -8. The time now is 03:26 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.