View Single Post
  #2  
Old 07-11-2016, 02:10 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Create a new table in XC database?

Quote:
Originally Posted by Ed B.
Is it possible to create a new table in XC database?

Absolutely. This is done by adding a Model into your Module.

Make a file in your module:
XLite\Module\YourDevID\YourModuleName\Model\Table. php

Code:
namespace XLite\Module\YourDevID\YourModuleName\Model; /** * @Entity * @Table (name="devid_some_table") */ class Table extends \XLite\Model\AEntity { /** * @Id * @GeneratedValue (strategy="AUTO") * @Column (type="integer", options={ "unsigned": true }) */ protected $id; /** * @Column (type="boolean") */ protected $enabled = true; /** * @Column (type="string", length=1024) */ protected $text = ''; }

Of course you can rename the Table.php class to reflect something more relevant to your cause, and change the field names to your liking.

This file above should create a table called "devid_some_table", which you can see in the comments and can change to your liking.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote