propelorm/Propel — Issue #262: Deep copy on one to one relations
Author: mkehren
Created: 2012-01-18 12:32:39+00:00
State: open

Looks like there is still a Problem when making a deep copy of a one to one relation. I tried this with the version 1.6.4:

Schema:

PHP:
set_include_path("path/to/build/classes" . PATH_SEPARATOR . get_include_path());
require_once 'propel/runtime/lib/Propel.php';
Propel::init("path/to/build/conf/test_db-conf.php");

$emp = BookstoreEmployeeQuery::create()
->filterByID(1)
->findOne();

$emp->copy(TRUE)->save();

Error:
Fatal error: Uncaught exception 'PropelException' with message 'Unable to execute INSERT statement [INSERT INTO `bookstore_employee_account` (`EMPLOYEE_ID`, `LOGIN`, `PASSWORD`) VALUES (:p0, :p1, :p2)] [wrapped: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY']' in /path/to/build/classes/test_db/om/BaseBookstoreEmployeeAccount.php:455 Stack trace: #0 /path/to/build/classes/test_db/om/BaseBookstoreEmployeeAccount.php(392): BaseBookstoreEmployeeAccount->doInsert(Object(PropelPDO)) #1 /path/to/build/classes/test_db/om/BaseBookstoreEmployeeAccount.php(341): BaseBookstoreEmployeeAccount->doSave(Object(PropelPDO)) #2 /path/to/build/classes/test_db/om/BaseBookstoreEmployee.php(362): BaseBookstoreEmployeeAccount->save(Object(PropelPDO)) #3 /path/to/build/classes/test_db/om/BaseBookstoreEmployee.php(304): BaseBookstoreEmployee->doSave(Object(PropelPDO)) #4 /path/to/index.php(16): BaseBookstoreEmploye in /path/to/build/classes/test_db/om/BaseBookstoreEmployeeAccount.php on line 455

This should be exactly the example from the website, isn't it?

Regards,
- Marcello