Created
May 14, 2012 07:11
-
-
Save patie/2692390 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Doctrine\ORM\Tools\ToolsException | |
Schema-Tool failed with Error 'SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "Order" LINE 1: ...17B8A4DF359E4DAB FOREIGN KEY (OrderId) REFERENCES Order (id)... ^' while executing DDL: ALTER TABLE Order_ShippingPackage ADD CONSTRAINT FK_17B8A4DF359E4DAB FOREIGN KEY (OrderId) REFERENCES Order (id) NOT DEFERRABLE INITIALLY IMMEDIATE search► | |
Caused by ▼ | |
PDOException #42601 | |
SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "Order" LINE 1: ...17B8A4DF359E4DAB FOREIGN KEY (OrderId) REFERENCES Order (id)... ^ | |
SQL ▼ | |
Time ms SQL Params | |
0.000 | |
ALTER TABLE Order_ShippingPackage ADD CONSTRAINT FK_17B8A4DF359E4DAB FOREIGN KEY (OrderId) | |
REFERENCES Order (id) NOT DEFERRABLE INITIALLY IMMEDIATE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Eshop\Model; | |
use Doctrine\Common\Collections\ArrayCollection; | |
/** | |
* @Entity | |
*/ | |
class Order extends \Nette\Object | |
{ | |
/** | |
* @Id | |
* @Column(type="integer") | |
* @GeneratedValue | |
*/ | |
private $id; | |
/** | |
* @Column(type="datetime") | |
*/ | |
private $date; | |
# ... dalsie properties ... | |
/** | |
* UNI OneToMany | |
* | |
* @ManyToMany(targetEntity="ShippingPackage") | |
* @JoinTable(name="Order_ShippingPackage", | |
* joinColumns={@JoinColumn(name="OrderId", referencedColumnName="id")}, | |
* inverseJoinColumns={@JoinColumn(name="ShippingPackageId", referencedColumnName="id", unique=true)} | |
* ) | |
**/ | |
private $shippingPackages; | |
public function __construct() | |
{ | |
$this->shippingPackages = new ArrayCollection; | |
} | |
# S H I P P I N G P A C K A G E S | |
public function getShippingPackages() | |
{ | |
return $this->shippingPackages; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Eshop\Model; | |
use Doctrine\Common\Collections\ArrayCollection; | |
/** | |
* @Entity | |
*/ | |
class ShippingPackage extends \Nette\Object | |
{ | |
/** | |
* @Id | |
* @Column(type="integer") | |
* @GeneratedValue | |
*/ | |
private $id; | |
/** | |
* @Column(type="datetime") | |
*/ | |
private $date; // datum odoslania | |
/** | |
* @Column(type="string") | |
*/ | |
private $code; | |
/** | |
* @Column(type="integer") | |
*/ | |
private $quantity; | |
/** | |
* @Column(type="decimal", scale=3, nullable=true) | |
*/ | |
private $weight; // kg | |
/** | |
* CONST | |
* | |
* @Column(type="integer") | |
*/ | |
private $status; | |
public function getDate() | |
{ | |
return $this->date; | |
} | |
public function setDate(\DateTime $date) | |
{ | |
$this->date = $date; | |
} | |
public function getCode() | |
{ | |
return $this->code; | |
} | |
public function setCode($code) | |
{ | |
$this->code = $code; | |
} | |
public function getQuantity() | |
{ | |
return $this->quantity; | |
} | |
public function setQuantity($quantity) | |
{ | |
$this->quantity = (int) $quantity; | |
} | |
public function getWeight() | |
{ | |
return $this->weight; | |
} | |
public function setWeight($weight) | |
{ | |
$this->weight = $weight; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment