codeinthehole / domain-model-mapper

A lightweight ORM package for PHP 5.3 based on the Data Mapper pattern.
Other
33 stars 9 forks source link

Problem with identifier #1

Open g-alonso opened 10 years ago

g-alonso commented 10 years ago

Hello, first thanks for sharing your work.

I am setting this model:

$user = new User;
//$user->USER_ID = null
$user->FULL_NAME = 'DBTEST_1';
$user->EMAIL = 'DBTEST_2';
$user->LOGIN = 'test';
$user->PASSWORD = '123456';

If I don't set the identifier field on the model class, the "find" method in "Mapper" class executes the following sql sentence with error.

SENTENCE: "SELECT * FROM USER WHERE "
PDO ERROR: Array
(
    [0] => HY000
    [1] => 936
    [2] => OCIStmtExecute: ORA-00936: missing expression
 (/home/galonso/php/php-5.3.21/ext/pdo_oci/oci_statement.c:148)
)

That happens because the method "__identity" on "BaseDomainModel" class only return those identifiers that exists and are not empty in model class data. Is this correct?

Am I doing something wrong?

juan-sanzone-olx commented 9 years ago

@g-alonso Are you using SAVE method or INSERT method to populate the object ?

g-alonso commented 9 years ago

@juan-sanzone-olx I dont remember, I will check this...