2008年8月27日星期三

Re: [fw-db] zend_db_table_row and quoting

I also use the function quoteInto() for my queries that require parameters.

All you have to do is have your query as a parameter in the quoteInto
Function. You can also concatenate your queries that require more than one
parameter. The quoteInto function only accepts one parameter.

in cases like yours with 3 parameters you will definitely need to
contatenate your queries using this function.

Something like this

$sql = $db->quoteInto('select EventName FROM Event WHERE
EventName=?',$form_data) . $db->quoteInto('AND EventID !=?', $request);

This is what the ZF Doc says regarding quoting your statements:
[QUOTE]
Note

The values and identifiers in the SQL expression are not quoted for you. If
you have values or identifiers that require quoting, you are responsible for
doing this. Use the quote(), quoteInto(), and quoteIdentifier() methods of
the database adapter.

[/QUOTE]
read more http://framework.zend.com/manual/en/zend.db.table.html


tony stamp wrote:
>
> Hello
>
> Just a quick question - when updating a row in a database, i usually do:
>
> $query = "update foo set bar = ?, baz = ?, goon = ?";
> $sth->execute($query, array('a', 'b', 'c');
>
> where i know that the db abstraction layer will apply quoting to make the
> values safe.
>
> If i'm using zend_db_table_row to update a database row, eg
>
> $row->name = $name;
> $row->surname = $surname;
> $row->save();
>
> ... will quoting also be applied to the row before saving, or is that the
> responsibility of the row to implement ie subclassing and performing
> validation on the properties before an update?
>


-----
dee
--
View this message in context: http://www.nabble.com/zend_db_table_row-and-quoting-tp19177390p19179720.html
Sent from the Zend DB mailing list archive at Nabble.com.

[fw-core] Zend_Form_Element 'name' and brackets.

Hi.

I want to create form with some checkbox. I need to get chceckbox values as array with
specified keys. I create this form by my class extended Zend_Form, and add fields in init()
method.

Problem is that Zend_Form_Element call filterName with 'allowBrackets' = flase. Why?
For Zend_Form_Element_Multicheckbox brackets are allowed, so why not for all elements?

regards,
Paweł Chuchmała

--
Paweł Chuchmała
pawel.chuchmala at gmail dot com

Re: [fw-mvc] Override name of elements in Zend_Form

On 25/08/2008 22:45, "Matthew Weier O'Phinney" <matthew@zend.com> wrote:

> -- Gordon Ross <gr306@ucs.cam.ac.uk> wrote
> (on Monday, 25 August 2008, 09:34 PM +0100):
>> Zend does a great job of auto-naming elements most of the time. (i.e.
>> by forming the id from the element's location in the structure of the
>> Zend_Form)
>>
>> However, occasionally, I'd like to override this completely. Is there
>> a way to stop Zend doing it's thing to the name ?
>
> Call one of:
>
> * $element->id = 'someidentifier'

Doesn't work (gives a PHP error)

> * $element->setAttrib('id', 'someidentifier');

That works great for id, but not for name. e.g. I'd like to change these
names:

<td>
<input type="submit" name="Footer[br][DDI]" id="Footer-br-DDI"
value="Process DDI"></td>
<td>

To something more meaningful.

Is there a way ?

Thanks,

GTG

[fw-mvc] Deep Cloning Zend_Config

I am getting unexpected behaviour when cloning a Zend_Config object:

Example (actual behaviour):

$parent = new Zend_Config(array('key' => array('nested' => 'parent')),
true); //allow read-write for merging
$newConfig = clone $parent;
$newConfig->merge(new Zend_Config(array('key' => array('nested' =>
'override')), true));
echo $newConfig->key->nested; // 'override' - as expected
echo $parent->key->nested; // 'override' - I was expecting this to be
'parent'


Intuitive behaviour (what makes sense):

Cloning a Zend_Config object should completely separate the new instance
from the original - i.e. there should be no cross-references.

$parent = new Zend_Config(array('key' => array('nested' => 'parent')),
true); //allow read-write for merging
$newConfig = clone $parent;
$newConfig->merge(new Zend_Config(array('key' => array('nested' =>
'override')), true));
echo $newConfig->key->nested; // 'override'
echo $parent->key->nested; // 'parent'


This is occurring because cloning Zend_Config only creates a shallow
clone currently.

Solution 1: Cast to an array and create a new instance:

This can be achieved already and effectively creates a deep clone.

$parent = new Zend_Config(array('key' => array('nested' => 'parent')),
true); //allow read-write for merging
$newConfig = new Zend_Config($parent->toArray(), true); //cast the
parent object to an array and create a new Zend_Config
$newConfig->merge(new Zend_Config(array('key' => array('nested' =>
'override')), true));
echo $newConfig->key->nested; // 'override' - as expected
echo $parent->key->nested; // 'parent' - as expected

Solution 2: Fixing Zend_Config to perform a deep clone:

/**
* Perform a deep clone of this instance to allow side-effect free
cloning.
* @return void
*/
public function __clone()
{
$data = array();
foreach ($this->_data as $key => $value)
{
if ($value instanceof Zend_Config)
{
$data[$key] = clone $value;
} else {
$data[$key] = $value;
}
}
$this->_data = $data;
}

Gives:

$parent = new Zend_Config(array('key' => array('nested' => 'parent')),
true); //allow read-write for merging
$newConfig = clone $parent;
$newConfig->merge(new Zend_Config(array('key' => array('nested' =>
'override')), true));
echo $newConfig->key->nested; // 'override' - as expected
echo $parent->key->nested; // 'parent' - as expected

It makes sense to me that this is the expected behaviour when cloning
and a deep clone greatly reduces the chance of hard to detect
side-effects. Does anybody disagree?

A full description of the above can be found at:
http://www.daniel-skinner.co.uk/cloning-zend_config-without-side-effects/26/08/2008

Test cases and a patch can be found at:
http://www.destiny-denied.co.uk/files/ZendConfigClone.zip

Kind Regards,

*Daniel Skinner*
**
skinner@destiny-denied.co.uk <mailto:skinner@destiny-denied.co.uk>
www.destiny-denied.co.uk <http://www.destiny-denied.co.uk/>

[fw-db] zend_db_table_row and quoting

Hello

Just a quick question - when updating a row in a database, i usually do:

$query = "update foo set bar = ?, baz = ?, goon = ?";
$sth->execute($query, array('a', 'b', 'c');

where i know that the db abstraction layer will apply quoting to make the
values safe.

If i'm using zend_db_table_row to update a database row, eg

$row->name = $name;
$row->surname = $surname;
$row->save();

... will quoting also be applied to the row before saving, or is that the
responsibility of the row to implement ie subclassing and performing
validation on the properties before an update?
--
View this message in context: http://www.nabble.com/zend_db_table_row-and-quoting-tp19177390p19177390.html
Sent from the Zend DB mailing list archive at Nabble.com.

RE: [fw-webservices] Zend_Soap_Client: use custom _soapClient object?

Hi Deiter,

 

Internal structure of Zend_Soap_Client was a bit changed with just released ZF 1.6.0 RC3

 

Zend_Soap_Client has _doRequest() method which may be overridden in children.

See Zend_Soap_Client_Local as an example.

 

 

PS Two additional methods intended to customize client behavior are _preProcessArguments() and _preProcessResult(). They are automatically invoked during a request.

 

With best regards,

   Alexander Veremyev.

 


From: Dieter Devlieghere [mailto:dieter.devlieghere@extendit.be]
Sent: Wednesday, August 20, 2008 6:34 PM
To: fw-webservices@lists.zend.com
Subject: [fw-webservices] Zend_Soap_Client: use custom _soapClient object?

 

Hi,

 

Is it possible to somehow override the __doRequest method of the _soapClient property of Zend_Soap_Client?

 

We have an issue where the soap server has problems with empty nodes and I would like to remove possible empty nodes on __doRequest()…

 

It seems kind of stupid to subclass Zend_Soap_Client only to use a different object as _soapClient (and rewrite the entire Zend_Soap_Client::_initSoapClientObject method)?

 

Regards,

Dieter Devlieghere

2008年8月26日星期二

Re: [fw-db] How to Increment a field by 1 using Update()

Bill Karwin wrote:
>
>
>
> $table = 'products';
> $data = array('prd_qnty' => new Zend_Db_Expr('prd_qnty + 1'));
> $where[] = $db->quoteInto('pr_id = ?', $this->pr_id);
> $db->update($table, $data, $where);
>
>

Hi Karwin
Thanks for ur help again..

Regards
Anees
--
View this message in context: http://www.nabble.com/How-to-Increment-a-field-by-1-using-Update%28%29-tp19161309p19174222.html
Sent from the Zend DB mailing list archive at Nabble.com.