|
|
|
| Re: symfony queue requests sent by a single browser session? [message #77726 is a reply to message #77720 ] |
Mon, 04 May 2009 14:41   |
Rubino Messages: 104 Registered: April 2009 Location: Barcelona |
Senior Member |
|
|
@tdslot:
Assuming your using Doctrine then modify your emailsTable class to include something like:
public function importRecord($thisData) {
$t = Doctrine_Record::fromArray($thisData)
->save();
}
public function importRecords($records) {
foreach($records as $thisRecord) {
$this->importRecord($thisRecord);
}
}
You can then use it by:
MyEmailTable->importRecord(array(
'name'=>$row[0],
'lastname'=>$row[1],
'email'=>$row[2]));
or, if you feel comfortable creating a properly formatted array of the data to load:
MyEmailTable->importRecords($formattedArray);
Something along those lines should work.
With the latter approach - it would be best to create chunks of records.
Doctrine appears to support bulk-inserts but I've been able to find any documentation on how this is implemented.
[Updated on: Mon, 04 May 2009 14:42] Virtual Machine for Symfony & Zend PHP Framworks
Website: http://www.sipx.ws
Support & Project tracker: http://trac.sipx.ws/projects/show/symfony-vm
|
|
|
|
| Re: symfony queue requests sent by a single browser session? [message #77740 is a reply to message #77732 ] |
Mon, 04 May 2009 17:57   |
Rubino Messages: 104 Registered: April 2009 Location: Barcelona |
Senior Member |
|
|
In the EmailTable.class.php you need to add the functions I listed.
Then from the code where you are creating the records (in your action?) where you had the loop to create the records - change the loop to use the lines (inside the loop itself):
MyEmailTable->importRecord(array(
'name'=>$row[0],
'lastname'=>$row[1],
'email'=>$row[2]));
What you're doing is creating a helper function in the EmailTable class that will insert the data for you quickly.
The first function I list is just a quick proxy for adding records - the second one allows you to send a batch of records to the function - which will then be created for you.
Virtual Machine for Symfony & Zend PHP Framworks
Website: http://www.sipx.ws
Support & Project tracker: http://trac.sipx.ws/projects/show/symfony-vm
|
|
|
|
|
|
|
| Re: symfony queue requests sent by a single browser session? [message #77825 is a reply to message #77781 ] |
Tue, 05 May 2009 20:12   |
Rubino Messages: 104 Registered: April 2009 Location: Barcelona |
Senior Member |
|
|
Wotcha,
The addressTable is a class with non-static methods - so in your action you'll need to create an instance to use it:
$addressTable = new AddressTable();
$addressTable->importAddress(...)...
Virtual Machine for Symfony & Zend PHP Framworks
Website: http://www.sipx.ws
Support & Project tracker: http://trac.sipx.ws/projects/show/symfony-vm
|
|
|
| Re: symfony queue requests sent by a single browser session? [message #77832 is a reply to message #77825 ] |
Tue, 05 May 2009 22:26  |
tdslot Messages: 8 Registered: July 2007 |
Junior Member |
|
|
so now i got error
Warning: Missing argument 1 for Doctrine_Table::__construct(), called in /usr/local/www/projects/ies/apps/invsend/modules/uploadfile/ actions/actions.class.php on line 60 and defined in /usr/local/share/pear/symfony/plugins/sfDoctrinePlugin/lib/v endor/doctrine/Doctrine/Table.php on line 218
Catchable fatal error: Argument 2 passed to Doctrine_Table::__construct() must be an instance of Doctrine_Connection, none given, called in /usr/local/www/projects/ies/apps/invsend/modules/uploadfile/ actions/actions.class.php on line 60 and defined in /usr/local/share/pear/symfony/plugins/sfDoctrinePlugin/lib/v endor/doctrine/Doctrine/Table.php on line 218
|
|
|