i have this schema Product: columns: name: string(255) description: clob price: { type: decimal, scale: 4 }
Order: tableName: m_order columns: total: { type: decimal, scale: 4 } relations: Items: class: OrderItem local: id foreign: order_id type: many foreignType: one cascade: [delete] OrderItem: columns: order_id: integer product_id: integer name: string(255) price: type: decimal scale: 4 quantity: integer total_price: type: decimal scale: 4 relations: Order: class: Order local: order_id foreign: id type: one foreignType: many onDelete: CASCADE Product: local: product_id foreign: id i want to override methods OrderItem->setProduct() and OrderItem- >setQuantity(). <?php class OrderItem extends BaseOrderItem { public function setProduct($product) { $this->_set('Product', $product); $this->setName($product->getName()); $this->setPrice($product->getPrice()); $this->calculate(); } public function setQuantity($quantity) { $this->_set('quantity', $quantity); $this->calculate(); } public function save(Doctrine_Connection $conn = null) { $this->calculate(); return parent::save($conn); } private function calculate() { if ($this->getPrice() && $this->getQuantity()) $this->setTotalPrice ($this->getQuantity() * $this->getPrice()); } } method OrderItem->setProduct() works in action but fails on load fixtures with error "Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Record or Doctrine_Null when setting one-to-one references." -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.