Author Topic: cant do docterine updates but can do selects and merge  (Read 502 times)

0 Members and 1 Guest are viewing this topic.

Offline cristalmolixTopic starter

  • Irregular
  • Posts: 21
    • View Profile
cant do docterine updates but can do selects and merge
« on: February 28, 2010, 05:08:43 PM »
this works

Code: [Select]

//class PageTable extends Doctrine_Table

$page = $this->createQuery()
->select('id, body')
->from('page')
->where("id = '".$page_id."'")
->limit(1)
->fetchArray(array(),  Doctrine::HYDRATE_NONE);

this works

Code: [Select]

$page = Doctrine::getTable(self::pageTable)->findOneById( $id ) ;


// NOTE you can perform updates to $page in many ways now none of them work except the below wich requires a validated form

$page->merge($form->getValues());


this dosent work

Code: [Select]

//class PageTable extends Doctrine_Table

$page = $this->createQuery()
->update('cms_page_part')
->set('content_html', $page_record['body'])
->set('content', $page_record['body'])
->where("id = '".$page_id."'")
->fetchArray(array(),  Doctrine::HYDRATE_NONE);



basically there is more than one way of doing updates and getting the object, i can get the object but cant do updates in any of the ways described,


the original developer of the app uses merge but i cant seem to do it with an array it has to be one of his validated arrays that the only object child of docterine object it accepts.

why cant i do straight up updates to objects i can retrieve.

i know all about the model and how to implement them in docterine


i can get the opbject inside the controler and perform it there or i can do it inside the table class still updates dont work


any help otherwise im gona have to do str8 up sql
« Last Edit: February 28, 2010, 05:13:27 PM by cristalmolix »

Offline cristalmolixTopic starter

  • Irregular
  • Posts: 21
    • View Profile
Re: cant do docterine updates but can do selects and merge
« Reply #1 on: February 28, 2010, 07:37:28 PM »
i know i should use an array for the set but like i said i tried quite a few different ways to update this