2008年7月31日星期四

[fw-db] ZF 1.6RC1, DB adapters and Character Set

Hi

How to use it? Right now i'm using old code:


$db = Zend_Db::factory( $config->database );
$db->getProfiler()->setEnabled( $config->debug );

$db->getConnection();
try
{
$db->query( 'SET NAMES utf8' );
$db->query( 'SET CHARACTER SET utf8' );
} catch( Exception $e )
{

}

There is info about built in support for character sets in ZF 1.6RC1,
but can't find it, and any combinations with charset, characterset etc
doesnt work for me... How can i use this new (long awaited) feature from
ini files?

--
K.

Re: [fw-db] Oracle cursors returned from stored procedures

Hey,
first i wanna say that it was a fast solution but working for me very well,
nonetheless it can be more flexible, because now this method binds always name *cursor* to the statement.

Usage:
        $params['rowsPerPage'] = 1;
        $params['order'] = 'date_added';
        $params['order_dir'] = 'ASC';
        $params['adId'] = (int)$adId;
        $sql = 'BEGIN dik.get_adverts(:cursor, :rowsPerPage, :order, :order_dir, :adId); END;';
       
        $rows = $this->_db->fetchCursor($sql, $params);

Code:

class My_Db_Adapter_Oracle extends Zend_Db_Adapter_Oracle
{
    public function fetchCursor($sql, $bind = array())
    {       
        $data = array();
        $conn = $this->getConnection();
       
        $curs = oci_new_cursor($conn);
        $stmt = oci_parse($conn, $sql);
       
        oci_bind_by_name($stmt, "cursor", $curs, -1, OCI_B_CURSOR);
        foreach ($bind as $key=>&$val) {
            oci_bind_by_name($stmt, $key, $val, -1, OCI_ASSOC);
        }

        oci_execute($stmt);
        if ($e = oci_error($stmt)) {
            throw new Zend_Db_Adapter_Oracle_Exception($e, -1234);
        }
        oci_execute($curs);
       
        if (oci_fetch_all($curs, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW)) {
          //  var_dump($data);
        }
       
        oci_free_statement($stmt);
        oci_free_statement($curs);
       
        return $data;
    }
}

--
Pagarbiai,
Vladas Diržys
Tel.: +370 620 69020
www.dirzys.com


On Thu, Jul 31, 2008 at 5:45 PM, tr0gd0rr <kendsnyder@gmail.com> wrote:


Gabriel Baez-2 wrote:
>
> This is how I call a oracle procedure using PDO
> ...
>

@Gabriel

Thanks for the input!

@funkyfly

I'd be so thankful if you could post some of your code!

Thanks,

Ken Snyder


--
View this message in context: http://www.nabble.com/Oracle-cursors-returned-from-stored-procedures-tp18634078p18756215.html
Sent from the Zend DB mailing list archive at Nabble.com.


Re: [fw-core] iPhone support

Great!
Thank you guys!

On Thu, Jul 31, 2008 at 6:25 PM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- Ramses Paiva <ramses@onecode.com.br> wrote
(on Thursday, 31 July 2008, 02:31 PM +0530):
> I'm currently working on a web application that is going to be accessed by
> iPhone devices and I'm wondering if the framework has some kind of support for
> this devices.

You may want to investigate the ContextSwitch action helper; you could
easily create a callback that examines the current HTTP headers to
switch contexts.

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/




--
Ramses Paiva
+91 97 4237 6432

Re: [fw-mvc] Problems with subForms

Matthew Weier O'Phinney-3 wrote:
>
>
> A display group is definitely the way to go if you want two elements in
> a row; use the order attribute of each element to determine the order in
> which they appear relative to eachother.
>
>

I.E, I dont't care the order of the display groups, but only the order of
the single elements, did I understand it right?

regards from Rostock at the baltic sea
--
View this message in context: http://www.nabble.com/Problems-with-subForms-tp18751896p18764050.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Display groups

-- Stephan Stapel <stephan.stapel@web.de> wrote
(on Thursday, 31 July 2008, 10:07 PM +0200):
> I'm getting on quite well with Zend_Form now including my custom elements.
>
> Unfortunately, a new question came up.
>
> For style reasons, form design bases on
>
> <fieldset>
> <div class="inner">
> <form> .... </form>
> </div>
> </fieldset>
>
> I now I can use display groups to create fieldsets but
> a) is this the best possible way
> and
> b) if so, how could I use the display group decorator to show both a
> fieldset and a div. There are rare examples on display group decorators
> on the internet unfortunately :(

This is relatively easy, actually. :)

$form->addDisplayGroup(array(...elements...), array(
'decorators' => array(
'FormElements',
array('HtmlTag', array('tag' => 'div', 'class' => 'inner'),
'Fieldset',
),
));

It's just like adding decorators for an element or a form.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

[fw-mvc] Display groups

Hi,

I'm getting on quite well with Zend_Form now including my custom elements.

Unfortunately, a new question came up.

For style reasons, form design bases on

<fieldset>
<div class="inner">
<form> .... </form>
</div>
</fieldset>

I now I can use display groups to create fieldsets but
a) is this the best possible way
and
b) if so, how could I use the display group decorator to show both a
fieldset and a div. There are rare examples on display group decorators
on the internet unfortunately :(

Hope you know an answer.

cheers,

Stephan

Re: [fw-mvc] Problems with subForms

-- Axel Wüstemann <awu@qbus.de> wrote
(on Thursday, 31 July 2008, 12:11 PM -0700):
> Matthew Weier O'Phinney-3 wrote:
> > http://framework.zend.com/issues/browse/ZF-3819
> >
> >
>
> Thank you. Would it be fixed in ZF1.6?

I'm going to try. :)

> May I ask another question?
>
> How the order of elements is calculated in relation to display groups or
> subforms?
> I have trubble get two elements in one row. My solution is to use display
> groups to have two elements in one html container. But with that, the
> elements are not any longer at there place.

Element order is determined either by order of registration with the
form, or by the order attribute of the element. When the elements are
part of a display group, they are rendered in the relative order in
which they would have appeared in the form.

A display group is definitely the way to go if you want two elements in
a row; use the order attribute of each element to determine the order in
which they appear relative to eachother.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-mvc] Problems with subForms

Matthew Weier O'Phinney-3 wrote:
>
>
> http://framework.zend.com/issues/browse/ZF-3819
>
>

Thank you. Would it be fixed in ZF1.6?

May I ask another question?

How the order of elements is calculated in relation to display groups or
subforms?
I have trubble get two elements in one row. My solution is to use display
groups to have two elements in one html container. But with that, the
elements are not any longer at there place.

Thank you in advance

Axel

--
View this message in context: http://www.nabble.com/Problems-with-subForms-tp18751896p18761432.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-db] _DB , Transactions usage questions

ok, thanks, I will look deeper into this then.

Kevin Hallmark wrote:
>
> $res should always exists if there is not a fatal error?
>
> With mysql, you'll either get a result set returned (whether the query did
> what you expect or not) or an exception thrown (for any mysql type errors,
> missing column, bad syntax, etc), causing an interruption of program flow.
>
> You probably need to validate that the operation succeeded a different
> way.
>
> Kevin
>
>
>

--
View this message in context: http://www.nabble.com/_DB-%2C-Transactions-usage-questions-tp18760601p18761260.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] _DB , Transactions usage questions

$res should always exists if there is not a fatal error?

With mysql, you'll either get a result set returned (whether the query did
what you expect or not) or an exception thrown (for any mysql type errors,
missing column, bad syntax, etc), causing an interruption of program flow.

You probably need to validate that the operation succeeded a different way.

Kevin


On 7/31/08 2:44 PM, "maxarbos" <maxarbos@yahoo.com> wrote:

>
> thanks for the quick response.
>
> i thought that all errors were non responss pretty much, and thus if
> anything was returned, it is a success.
> In some of my other code, i check for the existance of an error and then
> return on that check. But that is using pear classes of _Error and _MDB2
>
>
> here's one of the methods:
>
> public function doSomethingOne($operation, $incomingdata, $id=NULL) {
> $data = array(
> 'per_id' => $incomingdata['per_id'],
> 'val_one' => $incomingdata['val_one'],
> 's_id' => $incomingdata['s_id'],
> );
>
> if ($operation == 'insert') {
> $data['uni_id'] = $this->_u;
> $res = $this->_db->insert('block_table', $data);
> } elseif ($operation == 'update') {
> $res = $this->_db->update('block_table', $data,
> 'block_table_id = '.$this->_u.'
> AND id = '.$id);
> }
>
> if ($res)
> { return true; }
> else
> { return false; }
>
> }
>
>
>
> Kevin Hallmark wrote:
>>
>> Are the queries returning SQL errors or just not performing the action
>> properly?
>>
>> That block will only rollback if an actual exception is thrown. If the
>> query
>> just isn't producing the correct result, then you should check that in the
>> try block and throw your own exceptions.
>>
>> Kevin
>>
>>
>> On 7/31/08 2:23 PM, "maxarbos" <maxarbos@yahoo.com> wrote:
>>
>>>
>>> Hello,
>>>
>>> i have a question about Zend_DB
>>>
>>> 1: I am using transactions and it seems that my try block is not working
>>> correctly.
>>>
>>> Here is the code:
>>>
>>> $this->_db->beginTransaction();
>>>
>>> try {
>>> $this->block->doSomethingOne($one_info_action, $vals);
>>> $this->block->doSomethingTwo($two_info_action, $vals);
>>>
>>> $this->_db->commit();
>>>
>>> } catch (Exception $e) {
>>> $this->_db->rollBack();
>>> echo $e->getMessage();
>>> }
>>>
>>>
>>> Is this valid? Will the transaction and try block work correctly (if
>>> doSomethingOne and doSomethingTwo both succeed, then and only then, do
>>> the
>>> results commit)? I have a block just like this, but it seems as though
>>> some
>>> of the methods succeed, while others dont. Can methods be checked within
>>> a
>>> try/transaction block? (i hope this makes sense)
>>>
>>> Thanks.
>>
>>
>>

Re: [fw-db] _DB , Transactions usage questions

thanks for the quick response.

i thought that all errors were non responss pretty much, and thus if
anything was returned, it is a success.
In some of my other code, i check for the existance of an error and then
return on that check. But that is using pear classes of _Error and _MDB2


here's one of the methods:

public function doSomethingOne($operation, $incomingdata, $id=NULL) {
$data = array(
'per_id' => $incomingdata['per_id'],
'val_one' => $incomingdata['val_one'],
's_id' => $incomingdata['s_id'],
);

if ($operation == 'insert') {
$data['uni_id'] = $this->_u;
$res = $this->_db->insert('block_table', $data);
} elseif ($operation == 'update') {
$res = $this->_db->update('block_table', $data,
'block_table_id = '.$this->_u.'
AND id = '.$id);
}

if ($res)
{ return true; }
else
{ return false; }

}

Kevin Hallmark wrote:
>
> Are the queries returning SQL errors or just not performing the action
> properly?
>
> That block will only rollback if an actual exception is thrown. If the
> query
> just isn't producing the correct result, then you should check that in the
> try block and throw your own exceptions.
>
> Kevin
>
>
> On 7/31/08 2:23 PM, "maxarbos" <maxarbos@yahoo.com> wrote:
>
>>
>> Hello,
>>
>> i have a question about Zend_DB
>>
>> 1: I am using transactions and it seems that my try block is not working
>> correctly.
>>
>> Here is the code:
>>
>> $this->_db->beginTransaction();
>>
>> try {
>> $this->block->doSomethingOne($one_info_action, $vals);
>> $this->block->doSomethingTwo($two_info_action, $vals);
>>
>> $this->_db->commit();
>>
>> } catch (Exception $e) {
>> $this->_db->rollBack();
>> echo $e->getMessage();
>> }
>>
>>
>> Is this valid? Will the transaction and try block work correctly (if
>> doSomethingOne and doSomethingTwo both succeed, then and only then, do
>> the
>> results commit)? I have a block just like this, but it seems as though
>> some
>> of the methods succeed, while others dont. Can methods be checked within
>> a
>> try/transaction block? (i hope this makes sense)
>>
>> Thanks.
>
>
>

--
View this message in context: http://www.nabble.com/_DB-%2C-Transactions-usage-questions-tp18760601p18760941.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] _DB , Transactions usage questions

You may already know this, but if you're using MySQL, keep in mind that you need to use the InnoDB or BDB storage engines to support transactions.

http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-transactions.html

-Hector


Kevin Hallmark wrote:
Are the queries returning SQL errors or just not performing the action properly?   That block will only rollback if an actual exception is thrown. If the query just isn't producing the correct result, then you should check that in the try block and throw your own exceptions.  Kevin   On 7/31/08 2:23 PM, "maxarbos" <maxarbos@yahoo.com> wrote:    
Hello,  i have a question about Zend_DB  1: I am using transactions and it seems that my try block is not working correctly.  Here is the code:  $this->_db->beginTransaction();  try { $this->block->doSomethingOne($one_info_action, $vals); $this->block->doSomethingTwo($two_info_action, $vals);  $this->_db->commit();  } catch (Exception $e) {     $this->_db->rollBack();     echo $e->getMessage(); }   Is this valid? Will the transaction and try block work correctly (if doSomethingOne and doSomethingTwo both succeed, then and only then, do the results commit)?  I have a block just like this, but it seems as though some of the methods succeed, while others dont.  Can methods be checked within a try/transaction block? (i hope this makes sense)  Thanks.     
    

Re: [fw-db] _DB , Transactions usage questions

Are the queries returning SQL errors or just not performing the action
properly?

That block will only rollback if an actual exception is thrown. If the query
just isn't producing the correct result, then you should check that in the
try block and throw your own exceptions.

Kevin


On 7/31/08 2:23 PM, "maxarbos" <maxarbos@yahoo.com> wrote:

>
> Hello,
>
> i have a question about Zend_DB
>
> 1: I am using transactions and it seems that my try block is not working
> correctly.
>
> Here is the code:
>
> $this->_db->beginTransaction();
>
> try {
> $this->block->doSomethingOne($one_info_action, $vals);
> $this->block->doSomethingTwo($two_info_action, $vals);
>
> $this->_db->commit();
>
> } catch (Exception $e) {
> $this->_db->rollBack();
> echo $e->getMessage();
> }
>
>
> Is this valid? Will the transaction and try block work correctly (if
> doSomethingOne and doSomethingTwo both succeed, then and only then, do the
> results commit)? I have a block just like this, but it seems as though some
> of the methods succeed, while others dont. Can methods be checked within a
> try/transaction block? (i hope this makes sense)
>
> Thanks.

[fw-db] _DB , Transactions usage questions

Hello,

i have a question about Zend_DB

1: I am using transactions and it seems that my try block is not working
correctly.

Here is the code:

$this->_db->beginTransaction();

try {
$this->block->doSomethingOne($one_info_action, $vals);
$this->block->doSomethingTwo($two_info_action, $vals);

$this->_db->commit();

} catch (Exception $e) {
$this->_db->rollBack();
echo $e->getMessage();
}


Is this valid? Will the transaction and try block work correctly (if
doSomethingOne and doSomethingTwo both succeed, then and only then, do the
results commit)? I have a block just like this, but it seems as though some
of the methods succeed, while others dont. Can methods be checked within a
try/transaction block? (i hope this makes sense)

Thanks.
--
View this message in context: http://www.nabble.com/_DB-%2C-Transactions-usage-questions-tp18760601p18760601.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-mvc] Problems with subForms

-- Axel Wüstemann <awu@qbus.de> wrote
(on Thursday, 31 July 2008, 07:36 AM -0700):
> > You need to clone the sub form in each iteration; otherwise, the same
> > object is used, so whichever sub form name is registered last wins. Try
> > this instead:
> >
> > foreach($aSessions as $aSession) {
> > $clone = clone $oSubForm;
> > $oForm->addSubForm($clone, 'session_'.$aSession['EVENT_ID']);
> > }
> >
>
> This works, but regardless things go wrong.

I was able to reproduce the issue. Basically, the name is updating, but
the id is not. I've put an issue in the tracker for this:

http://framework.zend.com/issues/browse/ZF-3819


--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-db] Oracle cursors returned from stored procedures

Gabriel Baez-2 wrote:
>
> This is how I call a oracle procedure using PDO
> ...
>

@Gabriel

Thanks for the input!

@funkyfly

I'd be so thankful if you could post some of your code!

Thanks,

Ken Snyder


--
View this message in context: http://www.nabble.com/Oracle-cursors-returned-from-stored-procedures-tp18634078p18756215.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-core] Zend_Http_Client_Adapter_Curl

-- Steven <gatecrasher1981@gmail.com> wrote
(on Thursday, 31 July 2008, 03:05 PM +0100):
> Thanks for getting back to me Matthew. I'd be happy to look into this
> - where is the best place to find out the current status of the
> proposal?

There was never a formal proposal for the support. The best place to
look at this point is the code and unit tests.

> On Thu, Jul 31, 2008 at 1:56 PM, Matthew Weier O'Phinney
> <matthew@zend.com> wrote:
> > -- Steven <gatecrasher1981@gmail.com> wrote
> > (on Thursday, 31 July 2008, 12:12 PM +0100):
> > > Just a quick question - what is the current status on this
> > > Zend_Http_Client_Adapter_Curl? Will it make the 1.6 release? I noticed
> > > that it wasn't in the RC.
> >
> > This has been in the incubator in an incomplete state for over a year;
> > my understanding is that there has not been enough interest to justify
> > completing it. If you'd like to see it in a future release, please
> > consider submitting a CLA and helping finish development. :)

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-mvc] Problems with subForms

> You need to clone the sub form in each iteration; otherwise, the same
> object is used, so whichever sub form name is registered last wins. Try
> this instead:
>
> foreach($aSessions as $aSession) {
> $clone = clone $oSubForm;
> $oForm->addSubForm($clone, 'session_'.$aSession['EVENT_ID']);
> }
>

This works, but regardless things go wrong.

<form enctype="application/x-www-form-urlencoded"
action="event/registration/addtosession/event/11/part/1" method="post"><dl
class="zend_form">
<dt>&nbsp;</dt><dd><fieldset id="session_13"><dl>

<dt><label for="session_13-EVENT_ID"
class="optional">Veranstaltung</label></dt>
<dd>
<select name="session_13[EVENT_ID]" id="session_13-EVENT_ID" class="">
...
</select></dd>
<dt><label for="session_13-ACCOMPANIED_BY" class="em3
optional">ACCOMPANIED_BY</label></dt>
<dd>
<input type="text" name="session_13[ACCOMPANIED_BY]"
id="session_13-ACCOMPANIED_BY" value="" class="em3"></dd>
<dt><label for="session_13-COMPANIONS"
class="optional">COMPANIONS</label></dt>
<dd>
<textarea name="session_13[COMPANIONS]" id="session_13-COMPANIONS" class=""
rows="4" cols="40"></textarea></dd></dl></fieldset></dd>
<dt>&nbsp;</dt><dd>
<fieldset id="session_14"><dl>
<dt><label for="session_13-EVENT_ID"
class="optional">Veranstaltung</label></dt>
<dd>
<select name="session_14[EVENT_ID]" id="session_13-EVENT_ID" class="">
....
</select></dd>
<dt><label for="session_13-ACCOMPANIED_BY" class="em3
optional">ACCOMPANIED_BY</label></dt>
<dd>
<input type="text" name="session_14[ACCOMPANIED_BY]"
id="session_13-ACCOMPANIED_BY" value="" class="em3"></dd>
<dt><label for="session_13-COMPANIONS"
class="optional">COMPANIONS</label></dt>
<dd>
<textarea name="session_14[COMPANIONS]" id="session_13-COMPANIONS" class=""
rows="4" cols="40"></textarea></dd></dl></fieldset></dd>
<dt>&nbsp;</dt>
<dd><fieldset id="session_15"><dl>
<dt><label for="session_13-EVENT_ID"
class="optional">Veranstaltung</label></dt>
<dd>
<select name="session_15[EVENT_ID]" id="session_13-EVENT_ID" class="">
....
</select></dd>
<dt><label for="session_13-ACCOMPANIED_BY" class="em3
optional">ACCOMPANIED_BY</label></dt>
<dd>
<input type="text" name="session_15[ACCOMPANIED_BY]"
id="session_13-ACCOMPANIED_BY" value="" class="em3"></dd>
<dt><label for="session_13-COMPANIONS"
class="optional">COMPANIONS</label></dt>
<dd>
<textarea name="session_15[COMPANIONS]" id="session_13-COMPANIONS" class=""
rows="4" cols="40"></textarea></dd></dl></fieldset></dd>
<dt>&nbsp;</dt><dd><fieldset id="session_16"><dl>
<dt><label for="session_13-EVENT_ID"
class="optional">Veranstaltung</label></dt>
<dd>
<select name="session_16[EVENT_ID]" id="session_13-EVENT_ID" class="">
...
</select></dd>
<dt><label for="session_13-ACCOMPANIED_BY" class="em3
optional">ACCOMPANIED_BY</label></dt>
<dd>
<input type="text" name="session_16[ACCOMPANIED_BY]"
id="session_13-ACCOMPANIED_BY" value="" class="em3"></dd>
<dt><label for="session_13-COMPANIONS"
class="optional">COMPANIONS</label></dt>
<dd>
<textarea name="session_16[COMPANIONS]" id="session_13-COMPANIONS" class=""
rows="4" cols="40"></textarea></dd></dl></fieldset></dd></dl></form>

--
View this message in context: http://www.nabble.com/Problems-with-subForms-tp18751896p18756017.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-auth] Error throwing in Custom_Controller_Plugin_Acl::preDispatch

Hello,

I'm centralizing all the error logging in the ErrorController and everything gets interted in the DB. Also the ErrorController will display an error message depending on the type of exception (DB Error, Unauthorized access, etc).
The user credentials are all checked in my Custom_Controller_Plugin_Acl::
preDispatch call, if the user doesn't the required credentials I throw an Exception of type Zend_Acl_Exception so it get loggued and later on all unauthorized access can be reviewed.

The problem is when the exception is thrown, the ErrorController get called and display the error but the flow continue and the called controller (Ex: adminController) is getting called anyway...

Should I log the exception in the preDispatch call and simply change the controller name and action name? Or is there a way to stop the script from executing?

Thanks

Ben

Re: [fw-core] Zend_Http_Client_Adapter_Curl

Thanks for getting back to me Matthew. I'd be happy to look into this
- where is the best place to find out the current status of the
proposal?

Cheers,

Steve

On Thu, Jul 31, 2008 at 1:56 PM, Matthew Weier O'Phinney
<matthew@zend.com> wrote:
> -- Steven <gatecrasher1981@gmail.com> wrote
> (on Thursday, 31 July 2008, 12:12 PM +0100):
>> Just a quick question - what is the current status on this
>> Zend_Http_Client_Adapter_Curl? Will it make the 1.6 release? I noticed
>> that it wasn't in the RC.
>
> This has been in the incubator in an incomplete state for over a year;
> my understanding is that there has not been enough interest to justify
> completing it. If you'd like to see it in a future release, please
> consider submitting a CLA and helping finish development. :)
>
> --
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>
>

Re: [fw-mvc] Zend_Form: Element grouping

The prefix path needs to be set in your Bootstrap where you are setting up you View. You need to add a helper path to the view, and then register it with Zend_Controller_Action_HelperBroker Something like this:
        $view = new Zend_View;         $view->setEncoding('UTF-8');         $view->doctype('XHTML1_STRICT');         // Location of view helpers         $view->addHelperPath(             '../library/App/View/Helper',             'App_View_Helper_'         );         $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);         Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);         Zend_Layout::startMvc(); 
Stephan Stapel wrote:
How would your code look if one would indeed change the helper class name from Zend_View_Helper_FormDate to App_View_Helper_FormDate . I.e. where would I have to set addPrefix() or addPrefixPath()?


View this message in context: Re: Zend_Form: Element grouping
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-core] AjaxContext and ContextSwitch question

-- Ramon de la Fuente <ramon@delafuente.nl> wrote
(on Thursday, 31 July 2008, 10:27 AM +0200):
> I have started using the AjaxContext helper, but I'm running into the
> problem that although the right viewscript is being called
> (action.ajax.phtml), the Layout is not being disabled by default. I read
> this should happen when using ContextSwitch, and in the maual it states
> that AjaxContext is a special case of ContextSwitch; Am I reading it
> wrong?

I've been using AjaxContext and ContextSwitch without issue. Is it
possible that you're forwarding to another action? That could
potentially re-enable the layout.

Otherwise, can you provide a reproduce case for me to examine?

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-core] Zend_Http_Client_Adapter_Curl

-- Steven <gatecrasher1981@gmail.com> wrote
(on Thursday, 31 July 2008, 12:12 PM +0100):
> Just a quick question - what is the current status on this
> Zend_Http_Client_Adapter_Curl? Will it make the 1.6 release? I noticed
> that it wasn't in the RC.

This has been in the incubator in an incomplete state for over a year;
my understanding is that there has not been enough interest to justify
completing it. If you'd like to see it in a future release, please
consider submitting a CLA and helping finish development. :)

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-core] iPhone support

-- Ramses Paiva <ramses@onecode.com.br> wrote
(on Thursday, 31 July 2008, 02:31 PM +0530):
> I'm currently working on a web application that is going to be accessed by
> iPhone devices and I'm wondering if the framework has some kind of support for
> this devices.

You may want to investigate the ContextSwitch action helper; you could
easily create a callback that examines the current HTTP headers to
switch contexts.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-mvc] Problems with subForms

-- Axel Wüstemann <awu@qbus.de> wrote
(on Thursday, 31 July 2008, 03:42 AM -0700):
> For an event registration I need a registration form n-times, as n is the
> count of sessions or subevents of a main event.

<snip>

> Then I create an empty form with Zend_Form and add the n SubForms to it:
>
> foreach($aSessions as $aSession) {
> $oForm->addSubForm($oSubForm, 'session_'.$aSession['EVENT_ID']);
> }
>
> What I get ist: all Subforms will have the same Id:

You need to clone the sub form in each iteration; otherwise, the same
object is used, so whichever sub form name is registered last wins. Try
this instead:

foreach($aSessions as $aSession) {
$clone = clone $oSubForm;
$oForm->addSubForm($clone, 'session_'.$aSession['EVENT_ID']);
}

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-mvc] Serializing Zend_Form elements with array notation

-- Cristian Bichis <contact@zftutorials.com> wrote
(on Thursday, 31 July 2008, 10:19 AM +0300):
<snip>
> I am wondering if there is anything planned for serializing a Zend_Form (into a
> database).

Not currently; feel free to create a proposal. :)

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

[fw-core] Zend_Http_Client_Adapter_Curl

Hi all,

Just a quick question - what is the current status on this
Zend_Http_Client_Adapter_Curl? Will it make the 1.6 release? I noticed
that it wasn't in the RC.

Cheers,

Steve

[fw-mvc] Problems with subForms

For an event registration I need a registration form n-times, as n is the
count of sessions or subevents of a main event.

I build an form template for one session with Zend_Form_SubForm. The result
is:

<dt>&nbsp;</dt><dd><fieldset id=""><dl>
<dt><label for="EVENT_ID" class="optional">Veranstaltung</label></dt>
<dd>
<select name="EVENT_ID" id="EVENT_ID" class="">
...options...
</select></dd>
</dl></fieldset></dd>

Then I create an empty form with Zend_Form and add the n SubForms to it:

foreach($aSessions as $aSession) {
$oForm->addSubForm($oSubForm, 'session_'.$aSession['EVENT_ID']);
}

What I get ist: all Subforms will have the same Id:

<form enctype="application/x-www-form-urlencoded"
action="event/registration/addtosession/event/11/part/3" method="post"><dl
class="zend_form">
<dt>&nbsp;</dt><dd><fieldset id="session_16"><dl>
<dt><label for="EVENT_ID" class="optional">Veranstaltung</label></dt>
<dd>
<select name="session_16[EVENT_ID]" id="EVENT_ID" class="">
... options ...
</select></dd>
</dl></fieldset></dd>
<dt>&nbsp;</dt><dd><fieldset id="session_16"><dl>
<dt><label for="EVENT_ID" class="optional">Veranstaltung</label></dt>
<dd>
<select name="session_16[EVENT_ID]" id="EVENT_ID" class="">
... options ...
</select></dd>
</dl></fieldset></dd>
...
<dt>&nbsp;</dt><dd>
<input type="submit" name="submit_btn" id="submit_btn"
value="SUMIT"></dd></dl></form>

What do I wrong?

Thank you

Axel

--
View this message in context: http://www.nabble.com/Problems-with-subForms-tp18751896p18751896.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Proper way to change view script within controller action?

Hi Adam,

thanks for your quick response. Now I know that I was looking for

$this->_helper->viewRenderer->setRender('error404')

to get what I want. I am writing some controller tests and I wanted to
test if a controller actions changes the view script as expected. Now I
know how to do this... :-)

Thanks and best regards,

Ralf

Re: [fw-mvc] Proper way to change view script within controller action?

Hi,

I usually call $this->_helper->viewRenderer('view-script') to set
which view script I want to render.
$this->render('view-script') would have to be called at the end as you
said. If you are looking to get the contents of a rendered view script
in a variable, you can use $viewScript = $this->view-
>render('scriptdir/view-script.phtml');

Adam

On Jul 31, 2008, at 5:10 AM, Ralf Eggert wrote:

> Hi,
>
> just a quick question to make sure. Within a controller action called
> showAction I would like to change the script depending on the current
> design. So I would like to change it from 'show.phtml' to
> 'show1.phtml',
> 'show2.phtml' or 'show3.phtml'. What is the proper way to change the
> view script within a controller action?
>
> In the manual I found this section, which uses render():
> http://framework.zend.com/manual/en/zend.controller.action.html#zend.controller.action.viewintegration.render
>
> I guess that this render() method should be called at the end of the
> showAction method of the controller to make sure that all stuff is
> done
> within showAction.
>
> Or is there another way just to change the view script name without
> calling the render() method and let the View Renderer do the job?
>
> Best regards,
>
> Ralf
>

Re: [fw-core] iPhone support

Hi Ramses,

what do you mean with "support for these devices"? MobileSafari reads and displays HTML pages like every other browser does.

Best regards
Tobias

2008/7/31 Ramses Paiva <ramses@onecode.com.br>

I'm currently working on a web application that is going to be accessed by iPhone devices and I'm wondering if the framework has some kind of support for this devices.


Cheers,
--
Ramses Paiva
+91 97 4237 6432

[fw-mvc] Proper way to change view script within controller action?

Hi,

just a quick question to make sure. Within a controller action called
showAction I would like to change the script depending on the current
design. So I would like to change it from 'show.phtml' to 'show1.phtml',
'show2.phtml' or 'show3.phtml'. What is the proper way to change the
view script within a controller action?

In the manual I found this section, which uses render():
http://framework.zend.com/manual/en/zend.controller.action.html#zend.controller.action.viewintegration.render

I guess that this render() method should be called at the end of the
showAction method of the controller to make sure that all stuff is done
within showAction.

Or is there another way just to change the view script name without
calling the render() method and let the View Renderer do the job?

Best regards,

Ralf

Re: [fw-core] ZF 1.5 Controller problems in Linux

Hi Matthew,

Thanks for your help... i make an workarround that is renaming the controller classes... in this case from WsCustomerController to WscustomerController

Regards
  Carlos V.

On Thu, Jul 31, 2008 at 3:06 AM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- Carlos Vieira <carlos.vieira@gmail.com> wrote
(on Thursday, 31 July 2008, 01:28 AM +0100):
> I have an application based on ZF running on Windows platform with no problems
> at all.
> When i moved this application to Linux, i have a problem with the camel case
> named controllers... like this, for example:
>
> <...>
> class WsCustomerController extends Zend_Controller_Action {
> <...>
>
> If i use this controller in the windows installation, it works fine... in Linux
> installation this does not work... it's related to camel case name problems....
> don't know why this happens... the error is: "Invalid controller specified
> (wscustomer)"
>
> Anyone can help please!!! It's very urgent!!!

Please read the migration part of the manual:

   http://framework.zend.com/manual/en/zend.controller.migration.html#zend.controller.migration.fromoneohtoonefive

While the manual section talks about camelCased actions, most of those
rules also apply to controllers themselves.

Basically, you need to build your URLs appropriately.
'WsCustomerController' would map to 'ws-customer' at the URL level. If
you omit the dash, it resolves to 'WscustomerController'.

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/

[fw-core] iPhone support


I'm currently working on a web application that is going to be accessed by iPhone devices and I'm wondering if the framework has some kind of support for this devices.


Cheers,
--
Ramses Paiva
+91 97 4237 6432

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

Hector Virgen wrote:
>
>
> Is it possible to import a select query string into Zend_Db_Select and
> convert it to a select object? That would be pretty neat!
>
> <?php
>
> $sql = "SELECT * FROM `table` WHERE 1";
> $select = Zend_Db_Select::import($sql);
>
> ?>
>
>

This would be better:

<?php

$sql = <?sql SELECT * FROM `table` WHERE 1 ?>;
$select = Zend_Db_Select::import($sql);

?>

Where <?sql ?> is an SQL parser that returns an SQL object. I guess some
minor tweeks to the PHP parser would be needed for this.

monk.e.boy
--
View this message in context: http://www.nabble.com/re-2-%3A--fw-db--Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18728740p18750248.html
Sent from the Zend DB mailing list archive at Nabble.com.

[fw-core] AjaxContext and ContextSwitch question

Hi All,

I have started using the AjaxContext helper, but I'm running into the
problem that although the right viewscript is being called
(action.ajax.phtml), the Layout is not being disabled by default. I read
this should happen when using ContextSwitch, and in the maual it states
that AjaxContext is a special case of ContextSwitch; Am I reading it wrong?

Kind regards,


Ramon

[fw-mvc] Serializing Zend_Form elements with array notation

Hello,

Since lot of emails were referring to array notation on Zend_Form i have also one more question/problem.

I had couple weeks ago to store a form elements into a database. Form is quite complex, having elements with multi values as:

a multi file upload elements

[file][0]
[file][1]
........


or even a content element with subvalues as

[content][file][0]
[content][file][1]
.......................


What i had to store basically was:
- array notation (basically the "tree" of element values)
- values for each element into array notation
- type for each form element
- other data


I find out a rather simple (than very correct) way to store all those things within a database with keys like that (key1, key2, key3, value, type).

I am wondering if there is anything planned for serializing a Zend_Form (into a database).

Cristian

2008年7月30日星期三

Re: [fw-db] Oracle cursors returned from stored procedures

But this example doesn't output the cursor.
I have worked with Zend_Db and cursors, but that for I have extended the Zend_Db ...

So Zend_Db doesn't support it out of the box.

I can sent you classes, where you can find the way I've implemented it - later, when I'm at home.

--
Pagarbiai,
Vladas Diržys
Tel.: +370 620 69020
www.dirzys.com


On Wed, Jul 30, 2008 at 9:42 PM, Gabriel Baez <sheik316@gmail.com> wrote:
This is how I call a oracle procedure using PDO



$this->db->beginTransaction();   
                                  
        $stmt = $this->db->prepare("begin api.register_user(:email,:password,:firstname,:lastname,:phone,:job,:company,:authcode,:ipaddr,:role,:skip,:output); end;");                                                                                                                
        $stmt->bindParam(':email', $email,PDO::PARAM_STR);
        $stmt->bindParam(':password', $password, PDO::PARAM_STR);
        $stmt->bindParam(':firstname', $firstname, PDO::PARAM_STR);
        $stmt->bindParam(':lastname', $lastname, PDO::PARAM_STR);
        $stmt->bindParam(':phone', $phone, PDO::PARAM_STR);
        $stmt->bindParam(':job', $job, PDO::PARAM_STR);
        $stmt->bindParam(':company',$company,PDO::PARAM_STR);
        $stmt->bindParam(':authcode',$authcode,PDO::PARAM_STR);
        $stmt->bindParam(':ipaddr',$userip,PDO::PARAM_STR);
        $stmt->bindParam(':role',$role,PDO::PARAM_STR);
        $stmt->bindParam(':skip',$skip,PDO::PARAM_STR);
        $stmt->bindParam(':output', $output, PDO::PARAM_STR,200);                     
        $stmt->execute();                                                                                                                                                       
        $this->db->commit();





On Wed, Jul 30, 2008 at 11:50 AM, Bill Karwin <bill@karwin.com> wrote:



tr0gd0rr wrote:
>
> Has anyone worked with Oracle stored procedures that return result sets?
>

When I worked on Zend_Db, I never got around to supporting stored
procedures.

So you may have to use Zend_Db for the simple stuff, and access the
underlying connection object for calling procedures.  Call
$db->getConnection() to return the connection object, which is either of
type PDO or OCI8, depending on which Zend_Db adapter you're using.

That's all the advice I can offer on this subject.  Good luck.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Oracle-cursors-returned-from-stored-procedures-tp18634078p18737722.html
Sent from the Zend DB mailing list archive at Nabble.com.



Re: [fw-core] ZF 1.5 Controller problems in Linux

-- Carlos Vieira <carlos.vieira@gmail.com> wrote
(on Thursday, 31 July 2008, 01:28 AM +0100):
> I have an application based on ZF running on Windows platform with no problems
> at all.
> When i moved this application to Linux, i have a problem with the camel case
> named controllers... like this, for example:
>
> <...>
> class WsCustomerController extends Zend_Controller_Action {
> <...>
>
> If i use this controller in the windows installation, it works fine... in Linux
> installation this does not work... it's related to camel case name problems....
> don't know why this happens... the error is: "Invalid controller specified
> (wscustomer)"
>
> Anyone can help please!!! It's very urgent!!!

Please read the migration part of the manual:

http://framework.zend.com/manual/en/zend.controller.migration.html#zend.controller.migration.fromoneohtoonefive

While the manual section talks about camelCased actions, most of those
rules also apply to controllers themselves.

Basically, you need to build your URLs appropriately.
'WsCustomerController' would map to 'ws-customer' at the URL level. If
you omit the dash, it resolves to 'WscustomerController'.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

Re: [fw-core] ZF 1.5 Controller problems in Linux

Hi Carlos,

The problem is with the case-insensitive filesystem used on Windows
and Mac OS X (optional). To correct this change:
WsCustomerController.php to WscustomerController.php

Thanks,
John

On Jul 30, 2008, at 8:28 PM, Carlos Vieira wrote:

> Hi,
>
> I have an application based on ZF running on Windows platform with
> no problems at all.
> When i moved this application to Linux, i have a problem with the
> camel case named controllers... like this, for example:
>
> <...>
> class WsCustomerController extends Zend_Controller_Action {
> <...>
>
> If i use this controller in the windows installation, it works
> fine... in Linux installation this does not work... it's related to
> camel case name problems.... don't know why this happens... the
> error is: "Invalid controller specified (wscustomer)"
>
> Anyone can help please!!! It's very urgent!!!
>
> Thanks
> Regards
> Carlos V.

[fw-core] ZF 1.5 Controller problems in Linux

Hi,

I have an application based on ZF running on Windows platform with no problems at all.
When i moved this application to Linux, i have a problem with the camel case named controllers... like this, for example:

<...>
class WsCustomerController extends Zend_Controller_Action {
<...>

If i use this controller in the windows installation, it works fine... in Linux installation this does not work... it's related to camel case name problems.... don't know why this happens... the error is: "Invalid controller specified (wscustomer)"

Anyone can help please!!! It's very urgent!!!

Thanks
Regards
  Carlos V.

Re: [fw-webservices] Proposal suggested for a Zend_Feed_Reader

This is a good idea and I think you've covered all of the issues I've had with Zend_Feed, particularly with reading Slashdot's RSS feed (which I still have not been able to do).

I like your caching idea. I'd like to be able to set a default cache as a static property (similar to Zend_Db_Table_Abstract::setDefaultCache());

-Hector

Pádraic Brady wrote:
Your thoughts are welcome. Even if you write a longer email than me ;).

[fw-mvc] Just another Smarty View

Hello,

this is my first post to this list.
I recently discovered ZF and I've been looking into it for some weeks
now and I'm really happy with it so far.

Just out of my own interest I wrote/copy/pasted a Smarty View
implementation together and enhanced it by giving it access to view
helpers via Smarty plugins.
I think the Syntax is really nice, e.g. the URL helper:

<a href="{url controller=index action=edit id=$movie.id}">Edit</a>

And there are some more, if you want to take a look at it, I wrote a
small tut and have the code available for download at:
http://propaganda.io/tutorials/
Would really like to hear your feedback on it.


There is one open thing i will have to get into: When using the
action helper plugin, somehow the view doesn't get cloned properly,
so I loose all the data after calling an action helper.
Haven't had the time to look into it yet, maybe someone here has an
idea.

bye,
Murphy

Re: [fw-webservices] Proposal suggested for a Zend_Feed_Reader

On Wed, Jul 30, 2008 at 3:08 PM, Pádraic Brady <padraic.brady@yahoo.com> wrote:
> (...)
> Your thoughts are welcome. Even if you write a longer email than me ;).

I'll keep it short! :)

Sounds pretty awesome, I feel your pain with Zend_Feed (with no
offense meant to anyone of course) and I'd welcome your additions.

Cheers,
Till

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

Thanks Bill :)


Bill Karwin wrote:
>
>
>
> dele454 wrote:
>>
>> How do you find out the query joinLeftUsing() spills out from all those
>> function calls to your query building?
>>
>
> Once you have a select object that you have built with the procedural
> interface:
>
> $sql = $table->select()-> etc. etc. etc.
>
> You can get the full SQL query two ways. One is by calling the
> __toString() method on the object. This returns a string.
>
> $sqlString = $sql->__toString();
>
> The second way is by printing the select object. This implicitly calls
> __toString().
>
> print $sql . "\n";
>
> Regards,
> Bill Karwin
>


-----
dee
--
View this message in context: http://www.nabble.com/Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18688983p18740974.html
Sent from the Zend DB mailing list archive at Nabble.com.

[fw-webservices] Proposal suggested for a Zend_Feed_Reader

Hi all,

Being the ZF junkie that I am, I have been considering creating a proposal to address a few issues with Zend_Feed. Rather than let loose with the Proposal right away I figured I'd open the floor here (and on #zfdev where, for once :p, I am logged in at the moment), see what the community reception is, and steal...eh...borrow ideas where they make sense.

I'm currently towards the end of a second build of a simplified blog aggregation library based on Zend_Feed. Having done this twice I figured it was time to come up with a final solution so there's no third time ;).

In using Zend_Feed I've come to realise that it is largely an abstract API to PHP DOM. It imports, parses and presents a more natural API (akin to SimpleXML in a sense) for RSS and Atom feeds. However, Zend_Feed itself does not understand RSS or Atom - understanding these formats and their many versions is left entirely to the end programmer with a few exceptions. Zend_Feed_Reader's primary goal would be to take up the task of understanding and interpreting RSS and Atom.

This is a short email (from me, that means it's <3000 words ;)) throwing around some concepts for debate.

Current Potential Issues with Zend_Feed

Attempting to aggregate multiple feeds using different RSS and Atom standards requires a lot of extra work to correctly narrow all the available data down to common preferred points like: date, id, author, title, content, etc. It also means a lot of edge cases (malformed XML, non-standard RSS/Atom, etc.) also may need to be tracked by users. One of the few interpretive measures is being able to access RSS "content:encoded" data using a content() method. I also note "dc" namespaces are likewise resolved without the namespace prefix. Neither is consistent (e.g. content:encoded is accessible using the namespace prefix as the method name).

The second issue is that Zend_Feed is only minimally aware of HTTP. When given a URL it fetches that URL using Zend_Http_Client. Responses are neither cached nor conditionally fetched meaning that once again users must handle these scenarios by themselves or risk wasting precious memory, CPU cycles and bandwidth processing unchanged feeds. Not a biggie since it's easily implemented, but I've seen few Zend_Feed based apps doing it which is really poor practice in the wild.

A third potential problem is the assumption that all feeds will follow identical namespace patterns based on the namespace prefix (an arbitrary string). There are two examples here.

One is that some namespaces are resolved automatically by Zend_Feed while others are left unresolved which presents an inconsistent API. For example, an RSS 2.0 <entry> element might hold <dc:creator> and <slash:comments> elements with the <dc:creator> accessed as "$entry->creator()" (the dc namespace is automatically resolved by assumption) but the other only as "$entry->{'slash:comments'}" (the slash namespace is not resolved). This can become pretty confusing and require a lot of trial and error programming. Why doesn't "$entry->{'dc:creator'}" also return a typed result like "$entry->{'slash:comments'}?

The second is that namespaces are looked up based on the namespace prefix and not the namespace URI itself. Namespace prefixes may be standardised to a vast extent, but there's nothing illegal about using something different. If someone defined an alternate namespace prefix for "slash", existing source code based on using "$entry->{'slash:comments'}" would break. It's a much lesser point but some preemptive namespace registering would help here - there are only so many common extension out there.

Resolving Issues?

My own resolution ended up being an overhaul of how I used Zend_Feed. By adding a new interpretive layer it's possible to create an additional abstract API which both understands RSS and Atom versions, can present commonly requested data (prioritising similar elements) through a single set of accessor methods, and is invulnerable to namespace changes. It also makes internalising conditional fetches and caching simpler and standardised (whether there are meritable features is arguable but I think so). Originally I had considered building on top of Zend_Feed, but I've, to some extent, ended moving towards a parallel path where the base source is the DOMDocument Zend_Feed creates (allowing direct access to XPath and dynamic namespace registration) while maintaining access to Zend_Feed's other methods by proxy.

The point of the new proposal isn't to so much supercede Zend_Feed as extend it's API and capabilities to reduce the level of custom programming Zend_Feed needs to be surrounded with before it's useful in batch processing of RSS/Atom feeds where knowledge of any one specific feed is highly unlikely. I namespace it as Zend_Feed_Reader since it a separate class family not inheriting from Zend_Feed - rather it accepts Zend_Feed_Abstract instances through composition.

Your thoughts are welcome. Even if you write a longer email than me ;).

Best regards,
Paddy
 
Pádraic Brady

http://blog.astrumfutura.com
http://www.patternsforphp.com
OpenID Europe Foundation Member-Subscriber

[fw-webservices] Zend_Soap_Clieny compatibility matrix

Hi all,

I've just set up "Zend_Soap_Clieny compatibility matrix" document within
our wiki pages (http://framework.zend.com/wiki/x/GYBg).

It's intended to collect Zend_Soap_Client against other SOAP
implementations compatibility information.
Collected info should be used to reach compatibility with those
components.


Document already has two sections (.Net and JEE).
You are welcome to comment there, add compatibility info and add
sections for other SOAP implementations you want to access using
Zend_Soap_Client.


I already looked through SoapClient PHP documentation comments and put
some info into .Net General comments section.
Other parts of the document are empty now (only structure is defined).
I'm going to fill these parts within the next few days.


With best regards,
Alexander Veremyev.

Re: [fw-db] Oracle cursors returned from stored procedures

This is how I call a oracle procedure using PDO



$this->db->beginTransaction();   
                                  
        $stmt = $this->db->prepare("begin api.register_user(:email,:password,:firstname,:lastname,:phone,:job,:company,:authcode,:ipaddr,:role,:skip,:output); end;");                                                                                                                
        $stmt->bindParam(':email', $email,PDO::PARAM_STR);
        $stmt->bindParam(':password', $password, PDO::PARAM_STR);
        $stmt->bindParam(':firstname', $firstname, PDO::PARAM_STR);
        $stmt->bindParam(':lastname', $lastname, PDO::PARAM_STR);
        $stmt->bindParam(':phone', $phone, PDO::PARAM_STR);
        $stmt->bindParam(':job', $job, PDO::PARAM_STR);
        $stmt->bindParam(':company',$company,PDO::PARAM_STR);
        $stmt->bindParam(':authcode',$authcode,PDO::PARAM_STR);
        $stmt->bindParam(':ipaddr',$userip,PDO::PARAM_STR);
        $stmt->bindParam(':role',$role,PDO::PARAM_STR);
        $stmt->bindParam(':skip',$skip,PDO::PARAM_STR);
        $stmt->bindParam(':output', $output, PDO::PARAM_STR,200);                     
        $stmt->execute();                                                                                                                                                       
        $this->db->commit();




On Wed, Jul 30, 2008 at 11:50 AM, Bill Karwin <bill@karwin.com> wrote:



tr0gd0rr wrote:
>
> Has anyone worked with Oracle stored procedures that return result sets?
>

When I worked on Zend_Db, I never got around to supporting stored
procedures.

So you may have to use Zend_Db for the simple stuff, and access the
underlying connection object for calling procedures.  Call
$db->getConnection() to return the connection object, which is either of
type PDO or OCI8, depending on which Zend_Db adapter you're using.

That's all the advice I can offer on this subject.  Good luck.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Oracle-cursors-returned-from-stored-procedures-tp18634078p18737722.html
Sent from the Zend DB mailing list archive at Nabble.com.


Re: [fw-db] Oracle cursors returned from stored procedures

tr0gd0rr wrote:
>
> Has anyone worked with Oracle stored procedures that return result sets?
>

When I worked on Zend_Db, I never got around to supporting stored
procedures.

So you may have to use Zend_Db for the simple stuff, and access the
underlying connection object for calling procedures. Call
$db->getConnection() to return the connection object, which is either of
type PDO or OCI8, depending on which Zend_Db adapter you're using.

That's all the advice I can offer on this subject. Good luck.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Oracle-cursors-returned-from-stored-procedures-tp18634078p18737722.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

Haha I'm just saying it'd be pretty neat. :)

-Hector

Bill Karwin wrote:
  Hector Virgen wrote:   
Is it possible to import a select query string into Zend_Db_Select and  convert it to a select object? That would be pretty neat!      
 Heh!  You're welcome to write an LALR parser in PHP for SQL grammar.  Be my guest.  :-) Don't forget to include vendor-dependent syntax for all brands of database supported by ZF.    Regards, Bill Karwin   

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

Hector Virgen wrote:
>
> Is it possible to import a select query string into Zend_Db_Select and
> convert it to a select object? That would be pretty neat!
>

Heh! You're welcome to write an LALR parser in PHP for SQL grammar. Be my
guest. :-)
Don't forget to include vendor-dependent syntax for all brands of database
supported by ZF.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/re-2-%3A--fw-db--Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18728740p18736998.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] SQL debug please

Bill Karwin wrote:
>
>
> You may have to fetch "unfinished" query profiles. This feature never got
> documented. Here's how to use it:
>
> $db->getProfiler()->setEnabled(true);
> try {
> // ...execute broken SQL statement...
> } catch (Zend_Db_Exception $e) {
> foreach ($db->getProfiler()->getQueryProfiles(null, true) as $prof) {
> print $prof->getQuery() . "\n";
> }
> }
>
> The first argument to getQueryProfiles() is for the query type (or null
> for all types). The second argument is a boolean which defaults to false.
> If it's true, the function includes unfinished queries as well as finished
> queries in the array returned.
>
> Regards,
> Bill Karwin
>

Perfect! Thanks :-)

monk.e.boy

--
View this message in context: http://www.nabble.com/SQL-debug-please-tp18728846p18736941.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] SQL debug please

monk.e.boy wrote:
>
> I'd like to debug queries that are causing exceptions (i.e. my SQL is
> broken) how do I see the SQL that is being generated here?
>

You may have to fetch "unfinished" query profiles. This feature never got
documented. Here's how to use it:

$db->getProfiler()->setEnabled(true);
try {
// ...execute broken SQL statement...
} catch (Zend_Db_Exception $e) {
foreach ($db->getProfiler()->getQueryProfiles(null, true) as $prof) {
print $prof->getQuery() . "\n";
}
}

The first argument to getQueryProfiles() is for the query type (or null for
all types). The second argument is a boolean which defaults to false. If
it's true, the function includes unfinished queries as well as finished
queries in the array returned.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/SQL-debug-please-tp18728846p18736902.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

One of my favorite benefits of using select objects is that it's much easier to make conditional select queries. For example, I have a page that displays user-created public groups. But if the user is logged in, the select query is modified to also include subscribed private groups by joining the subscriptions table. I'm very thankful that Zend_Db_Select is flexible enough to make this easy.

Is it possible to import a select query string into Zend_Db_Select and convert it to a select object? That would be pretty neat!

<?php

$sql = "SELECT * FROM `table` WHERE 1";
$select = Zend_Db_Select::import($sql);

?>

Micah Gersten wrote:
One of the main reasons to use a SQL abstraction layer is so that DB engines can change if need be without too much trouble.    Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com    dele454 wrote:   
Indeed PDO is much more readable - with a good indentation implemented. I think there is definitely a place for Db Object Models one just has to find a balance between the two ie. when it is appropriate and convienient to go the object way or to simply stick to plain sql. I find plain sql much more simpler especially when you have written and testing your queries before hand. You simply copy and paste and not have to worry about the intricacies of how a Frameworks interpretes nested joins or queries :)  Am using a combination of both for now.    monk.e.boy wrote:        
 >>  Your query is this:  I ask thee, which is easier to read and understand? ::    $sql = <<<EOT       SELECT e.eventName, v.VenueName, c.City     FROM EventVenue ev     LEFT JOIN Event e ON ev.eventid=e.eventid     LEFT JOIN Venue v ON ev.venueid=v.venueid     LEFT JOIN Area a ON e.areaid=a.areaid     LEFT JOIN City c ON a.cityid=c.cityid;  EOT;   ---- or ----  $sql = $this->select()->setIntegrityCheck(false)     ->from($this, array() )     ->joinLeftUsing( array('e'=>'Event'), 'EventId', array('EventName') )     ->joinLeftUsing( array('v'=>'Venue'), 'VenueId', array('VenueName') )     ->joinLeft( array('a'=>'Area'), 'e.AreaId = a.AreaId', array() )     ->joinLeft( array('c'=>'City'), 'a.CityId = c.CityId', array('City') );  Object models are a neat idea, but good god, the code is a mess. It's starting to look like Perl....   monk.e.boy             
 ----- dee        
    

Re: re[2]: [fw-db] Using the Zend_Db_Table to return referenced row values

monk.e.boy wrote:
>
> I ask thee, which is easier to read and understand? ::
>

I agree completely; in cases where the complete SQL query is known, it's
much clearer to just write out the SQL by hand.

The Zend_Db_Select interface to build SQL queries procedurally is best used
when you need to build the query piece by piece as part of other application
logic. We've all had to write huge functions that append bits of string
together and hope it creates a valid SQL query in the end. Using
Zend_Db_Select makes it easier to do this.

When I wrote the docs on Zend_Db_Select, I tried to mention prominently that
using this interface is _not_ required, and in many situations it's both
easier and clearer to write the SQL literally.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/re-2-%3A--fw-db--Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18728740p18736633.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

dele454 wrote:
>
> How do you find out the query joinLeftUsing() spills out from all those
> function calls to your query building?
>

Once you have a select object that you have built with the procedural
interface:

$sql = $table->select()-> etc. etc. etc.

You can get the full SQL query two ways. One is by calling the __toString()
method on the object. This returns a string.

$sqlString = $sql->__toString();

The second way is by printing the select object. This implicitly calls
__toString().

print $sql . "\n";

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18688983p18736499.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] Using the Zend_Db_Table to return referenced row values

One of the main reasons to use a SQL abstraction layer is so that DB
engines can change if need be without too much trouble.


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com

dele454 wrote:
> Indeed PDO is much more readable - with a good indentation implemented. I
> think there is definitely a place for Db Object Models one just has to find
> a balance between the two ie. when it is appropriate and convienient to go
> the object way or to simply stick to plain sql. I find plain sql much more
> simpler especially when you have written and testing your queries before
> hand. You simply copy and paste and not have to worry about the intricacies
> of how a Frameworks interpretes nested joins or queries :)
>
> Am using a combination of both for now.
>
>
>
> monk.e.boy wrote:
>
>> >> Your query is this:
>>
>> I ask thee, which is easier to read and understand? ::
>>
>>
>> $sql = <<<EOT
>>
>>
>> SELECT e.eventName, v.VenueName, c.City
>> FROM EventVenue ev
>> LEFT JOIN Event e ON ev.eventid=e.eventid
>> LEFT JOIN Venue v ON ev.venueid=v.venueid
>> LEFT JOIN Area a ON e.areaid=a.areaid
>> LEFT JOIN City c ON a.cityid=c.cityid;
>>
>> EOT;
>>
>> ---- or ----
>>
>> $sql = $this->select()->setIntegrityCheck(false)
>> ->from($this, array() )
>> ->joinLeftUsing( array('e'=>'Event'), 'EventId', array('EventName') )
>> ->joinLeftUsing( array('v'=>'Venue'), 'VenueId', array('VenueName') )
>> ->joinLeft( array('a'=>'Area'), 'e.AreaId = a.AreaId', array() )
>> ->joinLeft( array('c'=>'City'), 'a.CityId = c.CityId', array('City')
>> );
>>
>> Object models are a neat idea, but good god, the code is a mess. It's
>> starting to look like Perl....
>>
>> monk.e.boy
>>
>>
>
>
> -----
> dee
>

Re: [fw-db] Oracle cursors returned from stored procedures

**BUMP**

Has anyone worked with Oracle stored procedures that return result sets?


tr0gd0rr wrote:
>
> Does anyone know of a way in Zend_Db to iterate cursors returned from
> stored procedures in Oracle?
>
> I see http://us.php.net/manual/en/function.oci-bind-by-name.php#83094
> this example of using oci_new_cursor() on php.net , but I don't see
> "oci_new_cursor" anywhere in the Zend source.
>
> Any help is appreciated.
>

--
View this message in context: http://www.nabble.com/Oracle-cursors-returned-from-stored-procedures-tp18634078p18734276.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-webservices] Zend_Rest_Server and Zend_Rest_Client error

Ok. sorry.

2008/7/30 Matthew Weier O'Phinney <matthew@zend.com>
Please do not cross post -- or, if you do, do so using CC.

I've answered this on fw-general already.

-- Adler Medrado <adlermedrado@gmail.com> wrote
(on Wednesday, 30 July 2008, 10:12 AM -0300):
> Hello All.
>
> I am trying to create a Zend_Rest_Server but it is not working and always
> return a response like that:
> <rest generator="zend" version="1.0">
> <response>
> <message>An unknown error occured. Please try again.</message>
> </response>
> <status>failed</status>
> </rest>
>
> Does anyone have some example? i think i am doing someting wrong but i am
> following the Documentation and i do not know where i can look for other
> tutorial/ code example.
>
> Below follow the sources:
> Server:
> public function indexAction()
>     {
>
>         $this->_helper->viewRenderer->
> setNoRender();
>         $this->_helper->layout->disableLayout();
>
>         $server = new Zend_Rest_Server();
>         $server->setClass('Example');
>         $server->handle();
>
>     }
>
>
> Client:
> public function clientAction()
>     {
>         $this->_helper->viewRenderer->setNoRender();
>         $this->_helper->layout->disableLayout();
>
>         $client = new Zend_Rest_Client('http://localhost/form/index/index');
>         echo $client->hello('adler')->delete();
>     }
>
> Example class:
> class Example {
>     public function hello($nome)
>     {
>         return "Hello $nome";
>     }
>
> }
>
>
> --
> adler medrado
>
> Consultor
> Zend Certified Engineer #ZEND003922
> http://www.adlermedrado.com.br

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/



--
adler medrado

Consultor
Zend Certified Engineer #ZEND003922
http://www.adlermedrado.com.br

Re: [fw-webservices] Zend_Rest_Server and Zend_Rest_Client error

Please do not cross post -- or, if you do, do so using CC.

I've answered this on fw-general already.

-- Adler Medrado <adlermedrado@gmail.com> wrote
(on Wednesday, 30 July 2008, 10:12 AM -0300):
> Hello All.
>
> I am trying to create a Zend_Rest_Server but it is not working and always
> return a response like that:
> <rest generator="zend" version="1.0">
> <response>
> <message>An unknown error occured. Please try again.</message>
> </response>
> <status>failed</status>
> </rest>
>
> Does anyone have some example? i think i am doing someting wrong but i am
> following the Documentation and i do not know where i can look for other
> tutorial/ code example.
>
> Below follow the sources:
> Server:
> public function indexAction()
> {
>
> $this->_helper->viewRenderer->
> setNoRender();
> $this->_helper->layout->disableLayout();
>
> $server = new Zend_Rest_Server();
> $server->setClass('Example');
> $server->handle();
>
> }
>
>
> Client:
> public function clientAction()
> {
> $this->_helper->viewRenderer->setNoRender();
> $this->_helper->layout->disableLayout();
>
> $client = new Zend_Rest_Client('http://localhost/form/index/index');
> echo $client->hello('adler')->delete();
> }
>
> Example class:
> class Example {
> public function hello($nome)
> {
> return "Hello $nome";
> }
>
> }
>
>
> --
> adler medrado
>
> Consultor
> Zend Certified Engineer #ZEND003922
> http://www.adlermedrado.com.br

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

[fw-webservices] Zend_Rest_Server and Zend_Rest_Client error

Hello All.

I am trying to create a Zend_Rest_Server but it is not working and always return a response like that:
<rest generator="zend" version="1.0">
<response>
<message>An unknown error occured. Please try again.</message>
</response>
<status>failed</status>
</rest>

Does anyone have some example? i think i am doing someting wrong but i am following the Documentation and i do not know where i can look for other tutorial/ code example.

Below follow the sources:
Server:
public function indexAction()
    {

        $this->_helper->viewRenderer->
setNoRender();
        $this->_helper->layout->disableLayout();

        $server = new Zend_Rest_Server();
        $server->setClass('Example');
        $server->handle();

    }


Client:
public function clientAction()
    {
        $this->_helper->viewRenderer->setNoRender();
        $this->_helper->layout->disableLayout();

        $client = new Zend_Rest_Client('http://localhost/form/index/index');
        echo $client->hello('adler')->delete();
    }

Example class:
class Example {
    public function hello($nome)
    {
        return "Hello $nome";
    }
   
}


--
adler medrado

Consultor
Zend Certified Engineer #ZEND003922
http://www.adlermedrado.com.br

[fw-db] Zend_Db_Table Column Alias Map

Hi,

I just create *NEW* proposal to Zend Framework. The proposal are placed in http://framework.zend.com/wiki/display/ZFPROP/Zend_Db_Table+Column+Alias+Map.

Many ORM needs map name of column difent of attribute name of object. Now in the Zend_Db_Table_Row_Abstract it isn't possible. Many developer implements a Zend_Db_Table_Row_Abstract class to make it, and many times these implementation is not good and not produtive. This component make it a way vary simple.

Regards
--
Fernando Chucre - LPIC-1
http://www.horizontesdigitais.com

Re: [fw-db] SQL debug please

Tobias Gies wrote:
>
> This option already exists. Check the manual for the Zend_Db_Profiler.
>
> Best regards
> Tobias
>
>

I'd like to debug queries that are causing exceptions (i.e. my SQL is
broken) how do I see the SQL that is being generated here?

For example, I think I have a bug where it is replacing '?' with an odd
value which is causing invalid SQL, but all I get is an exception and no
db_profile sql... :-(

Thanks,

monk.e.boy
--
View this message in context: http://www.nabble.com/SQL-debug-please-tp18728846p18731637.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: re[2]: [fw-db] Using the Zend_Db_Table to return referenced row values

Indeed PDO is much more readable - with a good indentation implemented. I
think there is definitely a place for Db Object Models one just has to find
a balance between the two ie. when it is appropriate and convienient to go
the object way or to simply stick to plain sql. I find plain sql much more
simpler especially when you have written and testing your queries before
hand. You simply copy and paste and not have to worry about the intricacies
of how a Frameworks interpretes nested joins or queries :)

Am using a combination of both for now.

monk.e.boy wrote:
>
> >> Your query is this:
>
> I ask thee, which is easier to read and understand? ::
>
>
> $sql = <<<EOT
>
>
> SELECT e.eventName, v.VenueName, c.City
> FROM EventVenue ev
> LEFT JOIN Event e ON ev.eventid=e.eventid
> LEFT JOIN Venue v ON ev.venueid=v.venueid
> LEFT JOIN Area a ON e.areaid=a.areaid
> LEFT JOIN City c ON a.cityid=c.cityid;
>
> EOT;
>
> ---- or ----
>
> $sql = $this->select()->setIntegrityCheck(false)
> ->from($this, array() )
> ->joinLeftUsing( array('e'=>'Event'), 'EventId', array('EventName') )
> ->joinLeftUsing( array('v'=>'Venue'), 'VenueId', array('VenueName') )
> ->joinLeft( array('a'=>'Area'), 'e.AreaId = a.AreaId', array() )
> ->joinLeft( array('c'=>'City'), 'a.CityId = c.CityId', array('City')
> );
>
> Object models are a neat idea, but good god, the code is a mess. It's
> starting to look like Perl....
>
> monk.e.boy
>


-----
dee
--
View this message in context: http://www.nabble.com/re-2-%3A--fw-db--Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18728740p18729744.html
Sent from the Zend DB mailing list archive at Nabble.com.