Search code examples
phppropelpropel2

php - Can't update table row using propel


What i'm gonna to do is just update one row form a table and using propel i've this code :

    $group = GroupsQuery::create()->findOneByGroupName('A');
    $group->setGroupName('B');
    $group->save();

but the problem is that nothing changes on the database and the group name is still A.

If i print the $group like print_r($group->toArray()) before using save() i get this :

    Array
    (
      [Id] => 4
      [GroupName] => A
    )

and after using save() i get this :

    Array
    (
      [Id] => 4
      [GroupName] => B
    )

which shows that the new value is inserted into the object but again not into the database. I've tested other queries like insert or delete and all of them work fine.


Solution

  • Well after doing some tests i found out the problem is that propel can't update a PRIMARY Key column so i changed primary key column and it worked.