products relations mapped well

This commit is contained in:
Ty Kayn 2018-03-15 16:18:06 +01:00
parent 79ab1b0246
commit ac1c0597ba
5 changed files with 162 additions and 122 deletions

187
.idea/workspace.xml generated
View File

@ -2,12 +2,10 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="77eba199-b6d3-40aa-8673-48ccff359364" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" afterPath="" />
<change beforePath="$PROJECT_DIR$/.idea/sf4-test.iml" afterPath="$PROJECT_DIR$/.idea/sf4-test.iml" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/composer.json" afterPath="$PROJECT_DIR$/composer.json" />
<change beforePath="$PROJECT_DIR$/composer.lock" afterPath="$PROJECT_DIR$/composer.lock" />
<change beforePath="$PROJECT_DIR$/templates/base.html.twig" afterPath="$PROJECT_DIR$/templates/base.html.twig" />
<change beforePath="$PROJECT_DIR$/src/Entity/Product.php" afterPath="$PROJECT_DIR$/src/Entity/Product.php" />
<change beforePath="$PROJECT_DIR$/src/Entity/ProductCategory.php" afterPath="$PROJECT_DIR$/src/Entity/ProductCategory.php" />
<change beforePath="$PROJECT_DIR$/src/Entity/SellRecord.php" afterPath="$PROJECT_DIR$/src/Entity/SellRecord.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@ -21,60 +19,38 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="600">
<file leaf-file-name="SellRecord.php" pinned="false" current-in-tab="true">
<file leaf-file-name="SellRecord.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Entity/SellRecord.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="780">
<caret line="21" column="0" lean-forward="true" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
<state relative-caret-position="650">
<caret line="13" column="7" lean-forward="false" selection-start-line="13" selection-start-column="7" selection-end-line="13" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="console" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/bin/console">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1560">
<caret line="3" column="4" lean-forward="false" selection-start-line="3" selection-start-column="4" selection-end-line="3" selection-end-column="4" />
<folding>
<element signature="e#26#41#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Product.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Entity/Product.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="130">
<caret line="23" column="53" lean-forward="false" selection-start-line="23" selection-start-column="53" selection-end-line="23" selection-end-column="53" />
<state relative-caret-position="453">
<caret line="31" column="45" lean-forward="false" selection-start-line="31" selection-start-column="45" selection-end-line="31" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SellRecordRepository.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Repository/SellRecordRepository.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-780">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ProductController.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Controller/ProductController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="581">
<caret line="33" column="43" lean-forward="false" selection-start-line="33" selection-start-column="43" selection-end-line="33" selection-end-column="43" />
<folding>
<element signature="e#34#57#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="index.html.twig" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/product/index.html.twig">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#12#26#0#Twig" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="base.html.twig" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/base.html.twig">
<provider selected="true" editor-type-id="text-editor">
@ -88,28 +64,18 @@
<file leaf-file-name="ProductCategory.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Entity/ProductCategory.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="910">
<caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<state relative-caret-position="388">
<caret line="25" column="22" lean-forward="false" selection-start-line="25" selection-start-column="22" selection-end-line="25" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="doctrine.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config/packages/prod/doctrine.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2015">
<caret line="31" column="0" lean-forward="false" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name=".env" pinned="false" current-in-tab="false">
<file leaf-file-name=".env" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1170">
<caret line="18" column="33" lean-forward="false" selection-start-line="18" selection-start-column="33" selection-end-line="18" selection-end-column="33" />
<state relative-caret-position="520">
<caret line="22" column="61" lean-forward="false" selection-start-line="22" selection-start-column="61" selection-end-line="22" selection-end-column="61" />
<folding />
</state>
</provider>
@ -118,7 +84,7 @@
<file leaf-file-name="doctrine.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config/packages/doctrine.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="780">
<state relative-caret-position="-195">
<caret line="12" column="24" lean-forward="false" selection-start-line="12" selection-start-column="24" selection-end-line="12" selection-end-column="24" />
<folding />
</state>
@ -130,7 +96,11 @@
<component name="FindInProjectRecents">
<findStrings>
<find>db_user</find>
<find>ManyToOne</find>
</findStrings>
<dirStrings>
<dir>$PROJECT_DIR$/src/Entity</dir>
</dirStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -140,8 +110,9 @@
<list>
<option value="$PROJECT_DIR$/src/Controller/ProductController.php" />
<option value="$PROJECT_DIR$/templates/base.html.twig" />
<option value="$PROJECT_DIR$/src/Entity/ProductCategory.php" />
<option value="$PROJECT_DIR$/.env" />
<option value="$PROJECT_DIR$/src/Entity/Product.php" />
<option value="$PROJECT_DIR$/src/Entity/ProductCategory.php" />
<option value="$PROJECT_DIR$/src/Entity/SellRecord.php" />
</list>
</option>
@ -330,12 +301,6 @@
<item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="Migrations" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="sf4-test" type="b2602c69:ProjectViewProjectNode" />
<item name="sf4-test" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="Repository" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="sf4-test" type="b2602c69:ProjectViewProjectNode" />
<item name="sf4-test" type="2a2b976b:PhpTreeStructureProvider$1" />
@ -399,27 +364,27 @@
<updated>1520949897852</updated>
<workItem from="1520949899279" duration="654000" />
<workItem from="1521124630756" duration="815000" />
<workItem from="1521125457191" duration="778000" />
<workItem from="1521125457191" duration="1508000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2247000" />
<option name="totallyTimeSpent" value="2977000" />
</component>
<component name="ToolWindowManager">
<frame x="1046" y="436" width="3761" height="2166" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32984293" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32984293" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32984293" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.124828905" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@ -428,7 +393,6 @@
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
@ -574,6 +538,7 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -633,22 +598,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/packages/doctrine.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="780">
<caret line="12" column="24" lean-forward="false" selection-start-line="12" selection-start-column="24" selection-end-line="12" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1170">
<caret line="18" column="33" lean-forward="false" selection-start-line="18" selection-start-column="33" selection-end-line="18" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Controller/ProductController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="581">
@ -677,22 +626,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Entity/ProductCategory.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="910">
<caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Entity/Product.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="130">
<caret line="23" column="53" lean-forward="false" selection-start-line="23" selection-start-column="53" selection-end-line="23" selection-end-column="53" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Repository/SellRecordRepository.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-780">
@ -701,10 +634,52 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/packages/doctrine.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-195">
<caret line="12" column="24" lean-forward="false" selection-start-line="12" selection-start-column="24" selection-end-line="12" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/bin/console">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1560">
<caret line="3" column="4" lean-forward="false" selection-start-line="3" selection-start-column="4" selection-end-line="3" selection-end-column="4" />
<folding>
<element signature="e#26#41#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Entity/ProductCategory.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="388">
<caret line="25" column="22" lean-forward="false" selection-start-line="25" selection-start-column="22" selection-end-line="25" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Entity/Product.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="453">
<caret line="31" column="45" lean-forward="false" selection-start-line="31" selection-start-column="45" selection-end-line="31" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Entity/SellRecord.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="780">
<caret line="21" column="0" lean-forward="true" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
<state relative-caret-position="650">
<caret line="13" column="7" lean-forward="false" selection-start-line="13" selection-start-column="7" selection-end-line="13" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="520">
<caret line="22" column="61" lean-forward="false" selection-start-line="22" selection-start-column="61" selection-end-line="22" selection-end-column="61" />
<folding />
</state>
</provider>

View File

@ -25,9 +25,13 @@ class Product {
*/
private $price;
/**
* @ORM\ManyToOne(targetEntity="ProductCategory", mappedBy="products")
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
*/
private $category;
/**
* @ORM\OneToMany(targetEntity="SellRecord", mappedBy="products")
*/
private $sellRecords;
/**
* @return mixed

View File

@ -21,10 +21,24 @@ class ProductCategory {
private $name;
/**
* @ORM\OneToMany(targetEntity="Product", inversedBy="category")
* @ORM\OneToMany(targetEntity="Product", mappedBy="category")
*/
private $products;
/**
* @return mixed
*/
public function getProducts() {
return $this->products;
}
/**
* @param mixed $products
*/
public function setProducts( $products ) {
$this->products = $products;
}
/**
* @return mixed
*/

View File

@ -9,16 +9,9 @@ use Doctrine\ORM\Mapping as ORM;
*/
class SellRecord {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @ORM\ManyToOne(targetEntity="Product", inversedBy="sellRecords")
*/
private $id;
/**
* @ORM/ManyToOne(targetEntity='Product')
*/
private $product;
private $products;
/**
@ -45,15 +38,15 @@ class SellRecord {
/**
* @return mixed
*/
public function getProduct() {
return $this->product;
public function getProducts() {
return $this->products;
}
/**
* @param mixed $product
* @param mixed $products
*/
public function setProduct( $product ) {
$this->product = $product;
public function setProducts( $products ) {
$this->products = $products;
}
/**

View File

@ -0,0 +1,54 @@
<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20180315151516 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE facture DROP FOREIGN KEY FK_FE86641019EB6921');
$this->addSql('ALTER TABLE transaction DROP FOREIGN KEY FK_723705D1C54C8C93');
$this->addSql('CREATE TABLE product_category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, name VARCHAR(100) NOT NULL, price NUMERIC(10, 2) DEFAULT NULL, INDEX IDX_D34A04AD12469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE sell_record (date DATETIME NOT NULL, products_id INT DEFAULT NULL, INDEX IDX_F9F12A026C8A81A9 (products_id), PRIMARY KEY(date)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD12469DE2 FOREIGN KEY (category_id) REFERENCES product_category (id)');
$this->addSql('ALTER TABLE sell_record ADD CONSTRAINT FK_F9F12A026C8A81A9 FOREIGN KEY (products_id) REFERENCES product (id)');
$this->addSql('DROP TABLE client');
$this->addSql('DROP TABLE facture');
$this->addSql('DROP TABLE transaction');
$this->addSql('DROP TABLE transaction_type');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD12469DE2');
$this->addSql('ALTER TABLE sell_record DROP FOREIGN KEY FK_F9F12A026C8A81A9');
$this->addSql('CREATE TABLE client (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, address VARCHAR(500) DEFAULT NULL COLLATE utf8_unicode_ci, type VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci, pay_delay INT DEFAULT NULL, UNIQUE INDEX UNIQ_C74404555E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE facture (id INT AUTO_INCREMENT NOT NULL, client_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci, description LONGTEXT DEFAULT NULL COLLATE utf8_unicode_ci, days DOUBLE PRECISION NOT NULL, total_ht DOUBLE PRECISION NOT NULL, total_ttc DOUBLE PRECISION DEFAULT NULL, sent_date DATETIME DEFAULT NULL, paid_date DATETIME DEFAULT NULL, days_to_pay INT DEFAULT NULL, INDEX IDX_FE86641019EB6921 (client_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE transaction (id INT AUTO_INCREMENT NOT NULL, type_id INT DEFAULT NULL, total_ht DOUBLE PRECISION NOT NULL, total_ttc DOUBLE PRECISION NOT NULL, title VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, date_paid DATETIME NOT NULL, date_creation DATETIME NOT NULL, INDEX IDX_723705D1C54C8C93 (type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE transaction_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, UNIQUE INDEX UNIQ_6E9D69885E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE facture ADD CONSTRAINT FK_FE86641019EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
$this->addSql('ALTER TABLE transaction ADD CONSTRAINT FK_723705D1C54C8C93 FOREIGN KEY (type_id) REFERENCES transaction_type (id)');
$this->addSql('DROP TABLE product_category');
$this->addSql('DROP TABLE product');
$this->addSql('DROP TABLE sell_record');
}
}