Re: [fw-general] Zend_Date Behavior: PEBKAC or Bug?

2011-03-03 Thread Ryan Lange
On Wed, Mar 2, 2011 at 10:56 PM, Simon Walter  wrote:

> On Thursday, March 03, 2011, Ryan Lange wrote:
> >   ["date_format"] => string(5) "d.M.y"
>
> I may be very very wrong about this, but wouldn't that be allowing a single
> digit for for any of the date parts?
>
> Here is what I read:
> M   Month, one or two digit
> d   Day of the month, one or two digit
> y   Year, at least one digit
>
> Maybe you should be doing:
> "dd.MM."
>
> Maybe you could use a constant, and that will help with localization:
> Zend_Date::DATE_SHORT
>
>
That doesn't seem to make a difference. A format of "dd.MM." should fail
to parse "29.2.2008", but it doesn't. Similarly, a year part of "y", "yy",
or "" all produce the same result (a successful parsing), whether the
year part of the input is "08" or "2008".

It seems that the format is only good for hinting at the order of the parts
in the input and not the overall format of the input or even the size of the
parts.


Ryan


Re: [fw-general] Re: Zend_Date Behavior: PEBKAC or Bug?

2011-03-03 Thread Ryan Lange
On Thu, Mar 3, 2011 at 1:57 AM, David Muir wrote:

> Zend_Date is next to useless for validating dates:
> http://framework.zend.com/issues/browse/ZF-7583
>

Well, that confirms that. Thanks.


> You're better off building your own date validator.
>

Everything seems to work as expected as long as you make sure the date is in
the expected format (in my case, by inserting a Zend_Validate_Regex rule
before Zend_Validate_Date).

For example, with that setup, an input of "29.2.2008" (February 29, 2008, a
leap year) validates, while an input of "29.2.2009" (February 29, 2009, not
a leap year) fails validation, as expected. An input of "2.29.2011" throws
an exception (Unable to parse date '2.29.2011' using 'd.M.' (M <> d)),
which is also expected.

It's apparently the format that's near useless for validation. It's only
seems to be good for hinting at the order in which the various parts should
appear in the input.


Ryan


[fw-general] Zend_Date Behavior: PEBKAC or Bug?

2011-03-02 Thread Ryan Lange
I'm having an issue with Zend_Date (and, by extension, Zend_Validate_Date)
that would seem to qualify as "unexpected behavior", but I'm not sure if
it's legitimately unexpected or if it's my expectations that are out of
whack.

First off, some basic information: I'm seeing this issue in ZF 1.11.3 on a
FreeBSD 6.4 system with PHP 5.2.14. Ultimately, I'm using Zend_Validate_Date
to validate date inputs from a form (e.g. date of birth).

Given this code...

 'd.M.y',
'format_type' => 'iso',
'fix_date' => false
) ) );

?>

...I would expect it to be unable to parse "123" as a date, since it doesn't
follow the specified format. Unfortunately, I get the following output:

array(5) {
  ["date_format"] => string(5) "d.M.y"
  ["locale"] => string(5) "en_US"
  ["day"] => string(2) "12"
  ["month"] => string(1) "3"
  ["year"] => bool(false)
}

This is a problem, because Zend_Validate_Date considers this a valid date.

 'd.M.y'
) );

Zend_Debug::dump( $validator->isValid( '123' ) );

?>

Output:

bool(true)

Now, if I use a value of "12.3" instead of "123", I get expected output:

array(4) {
  ["date_format"] => string(5) "d.M.y"
  ["locale"] => string(5) "en_US"
  ["day"] => string(2) "12"
  ["month"] => string(1) "3"
}

bool(false)

So... is what I've described above expected behavior and I'm just doing it
wrong, or is it a legitimate bug?

(Either way, I suppose I'll need to throw Zend_Validate_Regex into the mix
to make sure the input is in the correct format.)

Thanks in advance,
Ryan Lange


Re: [fw-general] Detecting a routing error in a controller plugin

2011-02-18 Thread Ryan Lange
Hi Hector,

Thanks for the response. If I'm understanding you correctly, you're
suggesting I do something like this:

class ErrorController extends Zend_Controller_Action
{
/**
 * @return void
 */
public function errorAction()
{
// Snipped code...

$this->renderScript( '../error/error.tpl.php' );
}
}

There are two issues with this, though: 1) it requires disabling LFI
protection, and 2) with LFI protection disabled, it works in the case of
modules (e.g. /module-name/foo), but breaks when routing errors occur in the
default module (e.g. /foo).


Thanks again,
Ryan


On Fri, Feb 18, 2011 at 4:27 PM, Hector Virgen  wrote:

> In your error controller, at the end of the errorAction() method, make a
> call to $this->renderScript() and pass in a relative path to your error
> script template -- "relative" as in relative to one of your view script
> paths. I hope this helps!
>
> --
> *Hector Virgen*
> Sr. Web Developer
> http://www.virgentech.com
>
>
>
> On Fri, Feb 18, 2011 at 12:14 PM, Ryan Lange wrote:
>
>> In an application that I'm creating, I have the need to have all view
>> scripts (including those for modules) in a non-standard directory, as well
>> as change the default extension. The relevant directory structure would
>> look
>> like this:
>>
>> /
>>application/
>>modules/
>>ModuleName/
>>public/
>>Templates/
>>zf-views/
>>module-name/
>>index/
>>index.tpl.php
>>error/
>>error.tpl.php
>>
>>  I've decided to use a controller plugin to do this globally:
>>
>> >
>> class Emg_Plugin_View extends Zend_Controller_Plugin_Abstract
>> {
>>/**
>> * @var Zend_Controller_Action_Helper_ViewRenderer
>> */
>>protected $_view_renderer;
>>
>>/**
>> * Sets the view script extension and the base script path before
>> routing
>> * occurs.
>> *
>> * This is done so that, if there's a routing error (e.g. invalid
>> module,
>> * controller, or action), the view script for the error controller can
>> be
>> * found.
>> *
>> * We can't check for the requested module and adjust the path
>> accordingly
>> * because that information hasn't been extracted from the requested
>> URI
>> at
>> * this point.
>> *
>> * @param Zend_Controller_Request_Abstract $request
>> * @return void
>> */
>>public function routeStartup( Zend_Controller_Request_Abstract $request
>> )
>>{
>>$this->_getViewRenderer()->setViewSuffix( 'tpl.php' );
>>$this->_getView()->setScriptPath( PUBLIC_PATH .
>> '/Templates/zf-views' );
>>}
>>
>>/**
>> * Adjusts the script path for modules.
>> *
>> * @param Zend_Controller_Request_Abstract $request
>> * @return void
>> */
>>public function dispatchLoopStartup( Zend_Controller_Request_Abstract
>> $request )
>>{
>>if( 'default' != $request->getModuleName() ) {
>>$this->_getView()->setScriptPath( PUBLIC_PATH .
>> '/Templates/zf-views/' . $request->getModuleName() );
>>}
>>}
>>
>>/**
>> * @return Zend_Controller_Action_Helper_ViewRenderer
>> */
>>protected function _getViewRenderer()
>>{
>>if( null === $this->_view_renderer ) {
>>$this->_view_renderer =
>> Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer' );
>>}
>>
>>return $this->_view_renderer;
>>}
>>
>>/**
>> * @return Zend_View_Interface
>> */
>>protected function _getView()
>>{
>>return $this->_getViewRenderer()->view;
>>}
>> }
>>
>> The problem I'm running into is that if a non-existent controller or
>> action
>> is requested in the ModuleName module (let's say /module-name/foo), I get
>> the following exception:
>>
>> Fatal error: Uncaught exception 'Zend_View_Exception' with message 'script
>> 'error/error.tpl.php' not found in path (> path>/application/views/scripts/:> path>/htdocs/Templates/zf-views/module-name/)' in > path>/library/Zend/View/Abstract.php:980
&

[fw-general] Detecting a routing error in a controller plugin

2011-02-18 Thread Ryan Lange
In an application that I'm creating, I have the need to have all view
scripts (including those for modules) in a non-standard directory, as well
as change the default extension. The relevant directory structure would look
like this:

/
application/
modules/
ModuleName/
public/
Templates/
zf-views/
module-name/
index/
index.tpl.php
error/
error.tpl.php

 I've decided to use a controller plugin to do this globally:

_getViewRenderer()->setViewSuffix( 'tpl.php' );
$this->_getView()->setScriptPath( PUBLIC_PATH .
'/Templates/zf-views' );
}

/**
 * Adjusts the script path for modules.
 *
 * @param Zend_Controller_Request_Abstract $request
 * @return void
 */
public function dispatchLoopStartup( Zend_Controller_Request_Abstract
$request )
{
if( 'default' != $request->getModuleName() ) {
$this->_getView()->setScriptPath( PUBLIC_PATH .
'/Templates/zf-views/' . $request->getModuleName() );
}
}

/**
 * @return Zend_Controller_Action_Helper_ViewRenderer
 */
protected function _getViewRenderer()
{
if( null === $this->_view_renderer ) {
$this->_view_renderer =
Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer' );
}

return $this->_view_renderer;
}

/**
 * @return Zend_View_Interface
 */
protected function _getView()
{
return $this->_getViewRenderer()->view;
}
}

The problem I'm running into is that if a non-existent controller or action
is requested in the ModuleName module (let's say /module-name/foo), I get
the following exception:

Fatal error: Uncaught exception 'Zend_View_Exception' with message 'script
'error/error.tpl.php' not found in path (/application/views/scripts/:/htdocs/Templates/zf-views/module-name/)' in /library/Zend/View/Abstract.php:980
Stack trace:
#0 /library/Zend/View/Abstract.php(876):
Zend_View_Abstract->_script('error/error.tpl...')
#1 /library/Zend/Controller/Action/Helper/ViewRenderer.php(898):
Zend_View_Abstract->render('error/error.tpl...')
#2 /library/Zend/Controller/Action/Helper/ViewRenderer.php(919):
Zend_Controller_Action_Helper_ViewRenderer->renderScript('error/error.tpl...',
NULL)
#3 /library/Zend/Controller/Action/Helper/ViewRenderer.php(958):
Zend_Controller_Action_Helper_ViewRenderer->render()
#4 /library/ in /library/Zend/View/Abstract.php on
line 980

Not surprisingly, given the code above, it's trying to look for the error
view script in ModuleName's view script path. What I need to do is, in
dispatchLoopStartup(), forgo updating the script path with the module name
if there's been a routing error. I'm just not sure how to go about that.
I've tried both of the following if conditions...

if( 'default' != $request->getModuleName() && 'error' !=
$request->getControllerName() ) {

...and...

if( 'default' != $request->getModuleName() && null === $request->getParam(
'error_handler' ) ) {

...but neither have solved my problem.

Any help would be appreciated. Any suggestions on how to handle the
situation in general more elegantly would also be appreciated. ;o)


Thanks,
Ryan Lange


Re: [fw-general] Letter case problem in Zend_Http_Response

2010-10-15 Thread Ryan Chan
On Fri, Oct 15, 2010 at 9:23 PM, Matthew Weier O'Phinney
 wrote:
> Again, are you running into _actual_ issues? Whether or not the
> conversion is necessary is a pointless argument at this point; the
> question is: is the behavior leading to problems? And would changing it
> open new issues elsewhere?
>


Not an actual issue, otherwise I have already reported a bug.

I just want to make sure if it is just a matter of author's taste, or
in fact I have missed some important stuffs.

When you do something, there must be some reasons behind, that's what
I want to classify.


Re: [fw-general] Letter case problem in Zend_Http_Response

2010-10-15 Thread Ryan Chan
Hi all,

On Fri, Oct 15, 2010 at 1:12 AM, Matthew Weier O'Phinney
 wrote:
>
> I think this may be due to how PHP handles header names, particularly
> the "Location" header. However, I'm not 100% positive; hopefully Shahar
> (author of the component) will jump in to respond.
>

The problem is if the response header contains two words or more,

e.g. Content-Type

It will be converted into

Content-type

IMHO, it is so strange and I see no point of converting, unless it is
part of some standard.


Re: [fw-general] Letter case problem in Zend_Http_Response

2010-10-14 Thread Ryan Chan
Hi,

On Fri, Oct 15, 2010 at 12:32 AM, Artem Stepin  wrote:
>  this should help:
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
>
> "Each header field consists of a name followed by a colon (":") and the
> field value. Field names are case-insensitive. "

So I just wonder why only 1st letter is uppercase.


[fw-general] Letter case problem in Zend_Http_Response

2010-10-14 Thread Ryan Chan
I have read the Zend_Http_Response:
http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Http/Response.php

The headers were constructed using...

$this->headers[ucwords(strtolower($name))] = $value;

So only 1st character will be upper case, others will be lower case.

Is it part of a standard? If yes, any document/reference/link?

Thanks.


[fw-general] Re: Zend_Log_Writer_Db and Firebug don't seem to work well together...

2010-10-11 Thread Ryan Lange
On Mon, Oct 11, 2010 at 11:57 AM, Ryan Lange  wrote:

> There's no outright conflict, per se, but the expectations of each writer
> can create issues when logging objects (at least). Zend_Log_Writer_Firebug
> can handle objects, but Zend_Log_Writer_Db, at some point in its execution,
> apparently attempts to call the __toString() magic method on objects.
>
> This causes a couple issues:
>
> 1) For classes, like Zend_Controller_Request_Http, that don't implement the
> __toString() magic method, logging an instance of that class causes
> Zend_Log_Writer_Db to throw an exception while Zend_Log_Writer_Firebug will
> handle it just fine.
>
> 2) What if you want to log the structure of, say, an instance of Zend_Form
> (for debugging), not the string representation? You could use something like
> print_r() and pass the output to the logger to accomodate
> Zend_Log_Writer_Db, but then you lose out on the object rendering feature of
> Zend_Log_Writer_Firebug.
>
> Does anyone have any suggestions for working around these issues?
>
>
> Thanks in advance,
> Ryan
>

I thought maybe I'd extend Zend_Log_Writer_Db and modify the _write() method
to convert non-string event messages to strings using print_r(), but all of
the class properties of Zend_Log_Writer_Db ($_db, $_table, and $_columnMap)
are set to private. So, naturally, when my overridden _write() method makes
sure that the $_db property is not null, it's denied access and results in
an exception informing me that it is null.

Bleh...


Ryan


[fw-general] Zend_Log_Writer_Db and Firebug don't seem to work well together...

2010-10-11 Thread Ryan Lange
There's no outright conflict, per se, but the expectations of each writer
can create issues when logging objects (at least). Zend_Log_Writer_Firebug
can handle objects, but Zend_Log_Writer_Db, at some point in its execution,
apparently attempts to call the __toString() magic method on objects.

This causes a couple issues:

1) For classes, like Zend_Controller_Request_Http, that don't implement the
__toString() magic method, logging an instance of that class causes
Zend_Log_Writer_Db to throw an exception while Zend_Log_Writer_Firebug will
handle it just fine.

2) What if you want to log the structure of, say, an instance of Zend_Form
(for debugging), not the string representation? You could use something like
print_r() and pass the output to the logger to accomodate
Zend_Log_Writer_Db, but then you lose out on the object rendering feature of
Zend_Log_Writer_Firebug.

Does anyone have any suggestions for working around these issues?


Thanks in advance,
Ryan


Re: [fw-general] Re: Rendering "miscellaneous" view scripts from within an action

2010-09-14 Thread Ryan Lange
On Thu, Aug 12, 2010 at 9:42 AM, Ryan Lange  wrote:

> On Wed, Aug 11, 2010 at 12:22 PM, Hector Virgen wrote:
>
>> You could also use a partial. Partials handle the cloning/var-clearing for
>> you.
>>
>> Also, be careful with getViewScript(), because it adds a suffix based on
>> the context. It's .phtml by default, but it could be .ajax.phtml if you're
>> using the AjaxContext action helper.
>>
>> --
>> Hector Virgen
>> Sent on my Droid X
>>
>
> Regarding using a partial, do you mean something like this?
>
> 
> $mail->setBodyHtml( $this->view->partial( 'emails/client.phtml' ) );
>
> ?>
>

It turns out that this does not work for my purposes. The initial problem
that I encountered exists with this method, too; the module, controller, and
action parts aren't present in the view script path. It appears that I must
make use of the ViewRenderer helper if I want to prevent potential
refactoring errors down the road. I'll just have to work around the possible
context switching issue if I ever encounter it.


Thanks,
Ryan


[fw-general] Re: [Zend_Form] Filtering or validating a composite element's array of values

2010-08-30 Thread Ryan Lange
On Mon, Aug 30, 2010 at 1:29 PM, Ryan Lange  wrote:

> I have a composite element (MultiCheckbox for pre-defined values + Text for
> custom values; all having the same name) that is having validation problems.
> The field is required (at the very least, one of the checkboxes must be
> checked *or* there must be a value in the text field).
>
> The problem is that text fields are always submitted and a NotEmpty
> validator will fail on an empty text field, even if one of the boxes is
> checked. Even a custom validator that uses the $context parameter is not
> ideal, as it will still be called for each and every value in the element's
> array.
>
> A similar problem with Zend_Filter_Input was worked around by hacking in a
> TRAVERSE_ARRAY boolean option, but that seems impossible to implement in
> Zend_Form without rebuilding the entire Zend_Form_Element_* family on top of
> a custom validator class.
>
> Does anyone have any thoughts on this?
>
>
> Thanks,
> Ryan
>

Wait... I think I'm missing the trees for the forest here. I think the
solution is to just override the isValid() method of my composite element.

/facepalm


Ryan


[fw-general] [Zend_Form] Filtering or validating a composite element's array of values

2010-08-30 Thread Ryan Lange
I have a composite element (MultiCheckbox for pre-defined values + Text for
custom values; all having the same name) that is having validation problems.
The field is required (at the very least, one of the checkboxes must be
checked *or* there must be a value in the text field).

The problem is that text fields are always submitted and a NotEmpty
validator will fail on an empty text field, even if one of the boxes is
checked. Even a custom validator that uses the $context parameter is not
ideal, as it will still be called for each and every value in the element's
array.

A similar problem with Zend_Filter_Input was worked around by hacking in a
TRAVERSE_ARRAY boolean option, but that seems impossible to implement in
Zend_Form without rebuilding the entire Zend_Form_Element_* family on top of
a custom validator class.

Does anyone have any thoughts on this?


Thanks,
Ryan


Re: [fw-general] can _getParam() get $_POST['bar']['foo'] ?

2010-08-30 Thread Jordan Ryan Moore
Currently, _getParam() can't access $_POST['person']['email']
directly. I miss this ability myself. I might be nice to add support
by passing an array of keys:

$this->_getParam(array('person', 'email'), $default);

I believe this would need to be added to the controller and request
classes. File a ticket in JIRA, and I'll take a look.

On Mon, Aug 30, 2010 at 9:14 AM, David Mintz  wrote:
> Just wondering if there's a way for a controller to use $this->_getParam()
> directly to get a POST datum which itself is within an array. Like with a
> subform for example. So if you have $_POST['person']['email'] can you get at
> the email in one _getParam() call? Or do you have to
>      $person = $this->_getParam('person') ;
> and then work with $person['email'] ?
>
>
>
>
> --
> Support real health care reform:
> http://phimg.org/
>
> --
> David Mintz
> http://davidmintz.org/
>
>
>



-- 
Jordan Ryan Moore


Re: [fw-general] Re: Rendering "miscellaneous" view scripts from within an action

2010-08-12 Thread Ryan Lange
On Wed, Aug 11, 2010 at 12:22 PM, Hector Virgen  wrote:

> You could also use a partial. Partials handle the cloning/var-clearing for
> you.
>
> Also, be careful with getViewScript(), because it adds a suffix based on
> the context. It's .phtml by default, but it could be .ajax.phtml if you're
> using the AjaxContext action helper.
>
> --
> Hector Virgen
> Sent on my Droid X
>

Regarding using a partial, do you mean something like this?

setBodyHtml( $this->view->partial( 'emails/client.phtml' ) );

?>

That would probably be a lot cleaner.

The only "problem" I see with that method—in my case, specifically—is that I
send two slightly different emails containing roughly the same information;
one to our client(s), the other as an internal notification. Using a full
view object allows me to assign the view variables once, then render two
different scripts.

I'm not opposed to assigning the information for each email (it may be good
to enforce some separation), but is there a way to avoid this? I think
placeholders would do the trick, but it sounds like anything put in a
placeholder would be available to all view scripts, not just the
email-related scripts. Hmm...


Thanks,
Ryan


[fw-general] Issues with non-default view script path in Zend_Application

2010-08-11 Thread Ryan Lange
I'm writing an application in 1.10.7 using Zend_Application. Due to
front-end design considerations, I have to change the location of the view
scripts (and only the view scripts). I have a few issues, though...

==
#1: Repetition
==

It appears that this needs to be done in each module's bootstrap. So, I do
this in the "default" bootstrap file:

bootstrap( 'View' );
$view = $this->getResource( 'View' );
$view->setScriptPath( realpath( APPLICATION_PATH . '/../custom/path'
) );
}
}

?>

But I also have to do this in the "Module" bootstrap file, adding the
module's name to the path:

bootstrap( 'View' );
$view = $this->getResource( 'View' );
$view->setScriptPath( realpath( APPLICATION_PATH .
'/../custom/path/module' ) );
}
}

?>

Is there a better way to do this globally and still have modules looking in
the correct directory? A controller plugin, perhaps? (I'm hoping a better
solution to this issue will make the next two disappear.)

==
#2: Default Paths Still Present
==

Zend_View::setScriptPath() overrides the default path(s). Unfortunately,
that doesn't appear to be the case here. Dumping the view object (inside of
a view script) reveals that the default path is still being checked.

["script"] => array(2) {
[0] => string(86) "[base]/application/views/scripts/"
[1] => string(69) "[base]/custom/path/"
}

["script"] => array(2) {
[0] => string(86) "[base]/application/modules/module/views/scripts/"
[1] => string(69) "[base]/custom/path/module/"
}

While this makes sense to me—these paths must be generated some time after
bootstrapping and then added to the view resource object—it's not very
optimal.

I'd like to completely override the default view script path. Any
suggestions?

==
#3: Error Handling in Modules
==

If ErrorController::errorAction() needs to be invoked by an exception in a
module, it seems to check the "default" default view script path, the
"Module" default view script path, and the "Module" custom view script path,
but *not* the "default" custom view script path:

[base]/application/views/scripts/
[base]/application/modules/module/views/scripts/
[base]/custom/path/module/

Consequently, with my setup, the view script for the error controller/action
can't be found, resulting in a fatal error.

Any help with these would be much appreciated.


Thanks,
Ryan


[fw-general] Re: Rendering "miscellaneous" view scripts from within an action

2010-08-11 Thread Ryan Lange
If anyone's interested, I've found a workable solution:

view;
$mail_view->clearVars();

$mail = new Zend_Mail( 'UTF-8' );
$mail->setBodyHtml(
$mail_view->render( $this->getHelper( 'ViewRenderer' )->getViewScript(
'emails/client' ) )
);

?>

This code is placed within an action method. Cloning the controller's view
object allows me to use the automatically generated paths for the view
rather than build them up from scratch myself. So, the view script that gets
rendered might be something like
"/application/views/scripts[controller]/[action]/emails/client.[suffix]" or,
if within a module,
"/application/modules/[module]/views/scripts[controller]/[action]/emails/client.[suffix]".

This only works because ViewRenderer::getViewScript() accepts directory
separators in the action name. That seems odd to me, but I'm thankful for it
at the moment.


On Wed, Feb 24, 2010 at 9:46 PM, Ryan Lange  wrote:

> Using the Zend_Application and the whole MVC shebang I have a controller
> action that needs to assemble and send an HTML email. I want to use
> Zend_View to render the body of the email and would like to keep the view
> script in a subfolder of the controller's view script folder.
>
> I understand that the ViewRenderer action helper is responsible for setting
> the script path based on module/controller when "auto-rendering", but I'm
> not sure how to use that to my advantage for mid-action rendering, or if
> it's even possible.
>
> I could set the script path manually, but I was hoping for an easier and
> less error-prone (say, in the event of a refactoring) method.
>
>
> Thanks in advance,
> Ryan
>


[fw-general] [Zend_Queue] How do you deal with repeated failures?

2010-08-05 Thread Ryan Lange
I'm using Zend_Queue (Db adapter, specifically) to store emails that are
generated by a front-end script to be processed by a back-end script (via
cron). Nothing out of the ordinary, really.

The problem is that these emails can fail for any number of reasons (the
user entering information on the front-end script may typo their email
address; the recipient's email address may no longer be valid; etc.). These
errors are logged so that they can be investigated by a human, but I'd like
for the queue to just "give up" on the problematic email after a few tries.

Unfortunately, there's doesn't seem to be a built-in mechanism for keeping
track of the number of times a specific message has been receive()d. Does
anyone have any tips on how to handle this situation?


Thanks,
Ryan


Re: [fw-general] Disable prepare statement in Zend_Db_Select

2010-06-08 Thread Ryan Chan
Hi,

On Tue, Jun 8, 2010 at 12:47 AM, Bill Karwin  wrote:
> Keep in mind that the round-trip you fear incurs too much overhead is
> actually not always a problem.  This article shows that at least in some
> cases, a prepared MySQL query actually runs 14% _faster_ than a non-prepared
> query:
> http://www.mysqlperformanceblog.com/2006/08/02/mysql-prepared-statements/
>

After reading the article, I think 'Query cache does not work" is a
strong enough reason not to use prepare statement.


[fw-general] Disable prepare statement in Zend_Db_Select

2010-06-07 Thread Ryan Chan
Hello,

I have traced the source code of ZFW, and found the database adapter
Zend_Db_Adapter_Mysqli  always do a prepare when execute any SQL.

However, I found it is not needed, since most of my query only run
once in their life cycle - no reuse is needed. It is possible to
disable auto prepare so it can save a MySQL roundtrip for the prepare
statement?

Thanks.


Re: [fw-general] Re: Trying to add some data to database from a form

2010-03-20 Thread Ryan Schmidt

On Mar 19, 2010, at 14:56, stelios wrote:

> ok i figured out the problem with your help, thanks for giving me to
> understand how it works. i moved my .php files here
> application\custom\modules and my images at application\custom\art so i have
> to change the image links in my php files can you help me ? first it is
> wrong to put my php code under this directories ?
> 
> /  logo.png   
> 
> what i have to put in logo.png place in order to work ? i put
> APPLICATION_PATH."/custom/art/logo.png" but  it doesn't work.

Images and anything else that needs to be served up directly by the web server 
goes in the "public" directory.

As vb said, please spend some more time reading how the framework works. Maybe 
go through a couple tutorials. It will help make things a bit clearer.



Re: [fw-general] Getting error when I try to create first project command line

2010-03-19 Thread Ryan Schmidt

On Mar 19, 2010, at 13:25, Jason Lehman wrote:

> I followed the installation directions but when I run the client I get:
> 
> PHP Fatal error:  Cannot access self:: when no class scope is active in
> /var/backup/zendframeworks/ZendFramework-1.10.2/library/Zend/Tool/Framework/Provider/Signature.php
> on line 355
> 
> 
> I have the path to the library in my php.ini and I see it when I do a php -i
> on the command line.
> 
> I am on CentOS 5.3 and using php 5.1.6 and ZendFramework 1.10.2.

PHP 5.2.4 or later is required.

http://framework.zend.com/manual/en/requirements.introduction.html




Re: [fw-general] Problems with Zend_Mail

2010-03-18 Thread Ryan Schmidt
On Mar 17, 2010, at 02:58, Mads Lie Jensen wrote:

> I'm using Zend_Mail to send out emails from inside a controller. The
> mail is sent like this:
> 
>   $tilmeldingAdresse = $this->_config->email->tilmelding->adresse;
>$tilmeldingNavn =
>utf8_decode($this->_config->email->tilmelding->navn);
>$mail = new Zend_Mail('iso-8859-15');
>$mail->setBodyText($content)
> ->setBodyHtml($contentHtml)
> ->setFrom($tilmeldingAdresse, $tilmeldingNavn)
> ->addCc($tilmeldingAdresse, $tilmeldingNavn)
> ->setHeaderEncoding(Zend_Mime::ENCODING_BASE64)
> ->setSubject('Tilmelding til Lionsmesse');
> 
>if ($til) {
>$mail->addTo($til, '');
>}
> 
>$mail->send();
> 
> Mail is sent ok, and when testing it arrives in my own mailbox as it
> should, looking ok.
> 
> But, some users, all using Outlook Express to view their emails gets
> this:
> 
> 
>> From: =?iso-8859-1?Q?Lions=20Club=20Vr=E5?= <>
>> Cc: tilmeld...@vishvaddukan.dk
>> Date: Thu, 04 Mar 2010 16:14:34 +0100
>> Content-Type: text/plain; charset=iso-8859-1
>> Content-Transfer-Encoding: quoted-printable
>> Content-Disposition: inline
>> MIME-Version: 1.0
>> Message-Id: <20100304151434.b08d967a...@quercus.palustris.dk>
>> X-CM-Analysis: v=1.1 cv=x4l5IIzddOdcCTxRlIDdCFlHT+bXbyaqAaDtMn28a6o= c=1 
>> sm=0 a=Jf0yzMfKMQz/KcSIlVTSog==:17 a=69EAbJre:8 a=gWR6SqXC:8 
>> a=W3anHg1yuHC3kRP9Y-gA:9 a=noP2OTjU9ZttMICO4cZeWNtITM4A:4 
>> a=j_f3kYImlrQA:10 a=EfJqPEOeqlMA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
>> 
>> =0ATak for tilmeldingen til Kunstmesse 2010=0A=0ADenne messe finder sted=
>> L=F8rdag den 25. september 2010 - s=F8ndag den 26. september 2010=0A=0A=
>> Du har indtastet f=F8lgende data:=0A=0A  Tilmelding nr.: 125=0A=
>>   Navn: Morten Gaarden=0A Adresse: Pr=E6steg=E5rdsvej 49=0A  =
>>   Postnr./by: 9480 L=F8kken=0A Telefon: 23367889=0A  =
>> Email: mortengaar...@hotmail.com=0a   Jeg udstiller: Malerier=0A  Beskr=
>> ivelse:=0A=0A=0A=0A  Stand nr.: 24 - Type 5 - 3,5x3,5 meter - 1100,- kr.=
>> =0A=0A=0A  Tilbeh=F8r:=0ABord - 50,- kr.=0AStol=
>> - 10,- kr.=0AStr=F8m - 100,- kr.=0A=0A=0A  Pris i a=
>> lt: 1260 kr.=0A=0AVi skal have din indbetaling hurtigst muligt, og senes=
>> t d.=0Amandag den 5. juli 2010.=0A=0ABel=F8bet (1260,- kr.) skal inds=E6=
>> ttes p=E5 konto: 9070 1620353066- HUSK at angive navn samt tilmeldingsnr=
>> . 125=0A=0AN=E5r din indbetaling er registreret vil du v=E6re at finde p=
>> =E5 siden http://www.vishvaddukan.dk/udstilling/udstillere/".=0A=0A=0A--=
>> =0AMed venlig hilsen,=0ALions Club, Vr=E5.=0A
>> 
> 
> What am I doing wrong here? In my own mailprogram (Forte Agent) it is
> showing as a nicely formatted text-email. Viewing it from my gmail
> account it is also shown as expected.

I haven't used Zend_Mail, but I have done some newsletter emailing so I have 
some experience with common mail sending errors. Mail standards say line 
endings in email must be the DOS CRLF pair, on all platforms. In your email I 
see a lot of "=0A" which is the encoding for the UNIX LF line ending. Is it 
possible your code, or Zend Framework code, is using "\n" or PHP_EOL as a line 
separator? If so, that would be an error; the line separator must be "\r\n". 
Some mail servers and mail clients are pickier about this than others, which 
would explain why only some of your users see this problem.





[fw-general] Re: Purpose of .zfproject.xml project file (was: Re: Quickstart and enable layout 1.10.2)

2010-03-13 Thread Ryan Schmidt

On Mar 13, 2010, at 06:43, Rob Allen wrote:

> On 11 Mar 2010, at 16:32, Jeffery wrote:
> 
>> I had copied the visible directories and files to another location.  I missed
>> the .zfproject.xml file
> 
> It's a shame there's not a "zf recreated projectfile" command :)

Does the .zfproject.xml file in fact serve any purpose at all other than 
wasting my time? I have found it very inconvenient to need to update it every 
time I manually add a model or controller or whatever, or to fix it after I "zf 
create"d something only to decide I needed to rename it later, but actually the 
application seems to work fine no matter what the project file contains, or 
indeed even if I delete the project file entirely. So what is it there for?




[fw-general] Generate code coverage report using phpunit/xdebug - using autoload

2010-03-11 Thread Ryan Chan
Hi,

Is it possible to config/bootstrap so it can generate  code coverage
report if I am using autoload?


I am following the codes in:

http://code.google.com/p/zendcasts/source/browse/trunk/zc25-unit-testing/tests/application/bootstrap.php

Any suggestion is highly recommended.


Re: [fw-general] Zend Framework application next to existing website

2010-03-05 Thread Ryan Lange

On 2/25/2010 4:53 AM, MrMastermindNL wrote:

Hi,

I've create a Zend Framework application and I now have to move it to the
webspace of my client. Unfortunately there's already a website running
there. So if I just upload my framework, the site wil not be visible
anymore.

So the question is, how can I upload and test my Zend Framework application
on the webspace of my client, without interferring with the current website?
   

I don't know your specific setup, but this is what I did:

First, I renamed the file "index.php" to "zf.php". I also changed the 
reference in the .htaccess file.


Second, I modified the .htaccess file further, so that only certain 
requests would be handled by my application. This part isn't strictly 
necessary because the default rewrite rules will only redirect requests 
for files or directories (or symlinks) that *don't* already exist 
(meaning your existing pages should still be accessible through the same 
URL as always). However, this *will* cause Zend Framework to "handle" 
any broken links. I didn't want that behavior, which is why I took this 
step.


My modified .htaccess looks something like this:

=[ .htaccess ]==
RewriteEngine On

# The following URIs will be handled by ZF.
RewriteCond %{REQUEST_URI} ^/controller [OR]
RewriteCond %{REQUEST_URI} ^/another-controller [OR]
RewriteCond %{REQUEST_URI} ^/module1 [OR]
RewriteCond %{REQUEST_URI} ^/module2/some-controller
RewriteRule ^.*$ zf.php [NC,L]


Hope that helps.

Ryan


Re: [fw-general] Redundant include paths in Zend_Tool-generated projects?

2010-03-01 Thread Ryan Lange
On Mon, Mar 1, 2010 at 11:46 AM, Hector Virgen  wrote:

> That looks redundant to me. Can you verify that your include path actually
> contains the same path twice?
>
> --
> Hector


Yep. get_include_path() returns
"/path/to/application/../library:/path/to/library:.:/usr/local/php5/lib/php".


[fw-general] Redundant include paths in Zend_Tool-generated projects?

2010-03-01 Thread Ryan Lange
When you create a project with Zend_Tool, it appears to add library/ to the
include path twice; once in application/configs/application.ini and again in
public/index.php.

==
application/configs/application.ini
==
includePaths[] = APPLICATION_PATH "/../library"


==
public/index.php
==
set_include_path( implode( PATH_SEPARATOR, array(
realpath( APPLICATION_PATH . '/../library' ),
get_include_path(),
) ) );


Am I correct in assuming that this is simply redundant?


[fw-general] Is there a way to suppress specific validator error messages?

2010-02-12 Thread Ryan Lange
My specific concern is with Zend_Validate_EmailAddress and host name
validation. In the case of an input like "exam...@examplecom" (missing
period in the host name), the validator returns 3 distinct error messages.
Zend_Validate_EmailAddress sets its own message for host name validation
failure, but it also pulls in all error messages (in this case, 2) from the
Zend_Validate_Hostname instance it uses.

Now, showing the user 3 error messages that say essentially the same thing
("Your email address appears to be invalid") seems a bit much.

Keep in mind that this is not a question about *customizing* validator
messages. I use Zend_Translate for that purpose, but, in my case, I'm still
left with 3 identical error messages. I'm wondering if anyone knows of a way
to simply "throw away" specific error messages. (On a whim, I tried setting
the message templates to NULL, but that just ends up returning an empty
string.)

Thanks in advance,
Ryan


Re: [fw-general] custom validation error messages in ZF >= 1.8

2009-12-02 Thread Ryan Lange
It appears I was using an older version of ZF (1.9.1, specifically). This
issue was apparently fixed in v1.9.3 (<
http://framework.zend.com/issues/browse/ZF-7034>). Silly me.


On Tue, Dec 1, 2009 at 11:14 AM, Ryan Lange  wrote:

> It looks like Zend_Filter_Input, for some reason, automatically runs a
> NotEmpty validator on every field. The message you're seeing is
> Zend_Filter_Input's NOT_EMPTY_MESSAGE.
>
> Setting the ALLOW_EMPTY meta command will get rid of it, but, of course,
> won't run your own NotEmpty validator.
>
> I haven't figured out a way to override this, though. And customizing
> NOT_EMPTY_MESSAGE is out of the question, because I want per-field messages
> (that don't reference the field name).
>
> Does anyone have a solution?
>
>
>
> On Thu, Aug 20, 2009 at 10:59 AM, David Mintz wrote:
>
>> I could use some help figuring out how to override the default validation
>> error messages with my own. Consider this snippet, based on the example in
>> the docs:
>>
>>
>> $validators = array(
>> 'month' => array(
>> 'NotEmpty',
>> 'Digits',
>> 'messages' => array(
>> 0 =>'my custom message: this is empty',
>> 1=>'my custom message: this ain\'t digits!'),
>> )
>> );
>> $input = new Zend_Filter_Input(null,$validators,
>> array(
>> 'month'=>''
>> )
>> );
>> if ($input->isValid()) {
>> echo "input is valid\n" ;
>> } else {
>> print_r($input->getMessages());
>> }
>>
>>
>> Output when I run this in 1.7.8:
>>
>> Array
>> (
>> [month] => Array
>> (
>> [isEmpty] => my custom message: this is empty yo
>> [stringEmpty] => '' is an empty string
>> )
>>
>> )
>>
>> Output when I run this in 1.9.0: (undesired):
>>
>>
>> Array
>> (
>> [month] => Array
>> (
>> [isEmpty] => You must give a non-empty value for field 'month'
>> )
>>
>> )
>>
>> I am having this problem with several Zend validation classes, not just
>> Zend_Validate_NotEmpty. Any help is much appreciated.
>>
>> --
>> David Mintz
>> http://davidmintz.org/
>>
>> The subtle source is clear and bright
>> The tributary streams flow through the darkness
>>
>
>


Re: [fw-general] custom validation error messages in ZF >= 1.8

2009-12-01 Thread Ryan Lange
It looks like Zend_Filter_Input, for some reason, automatically runs a
NotEmpty validator on every field. The message you're seeing is
Zend_Filter_Input's NOT_EMPTY_MESSAGE.

Setting the ALLOW_EMPTY meta command will get rid of it, but, of course,
won't run your own NotEmpty validator.

I haven't figured out a way to override this, though. And customizing
NOT_EMPTY_MESSAGE is out of the question, because I want per-field messages
(that don't reference the field name).

Does anyone have a solution?


On Thu, Aug 20, 2009 at 10:59 AM, David Mintz  wrote:

> I could use some help figuring out how to override the default validation
> error messages with my own. Consider this snippet, based on the example in
> the docs:
>
>
> $validators = array(
> 'month' => array(
> 'NotEmpty',
> 'Digits',
> 'messages' => array(
> 0 =>'my custom message: this is empty',
> 1=>'my custom message: this ain\'t digits!'),
> )
> );
> $input = new Zend_Filter_Input(null,$validators,
> array(
> 'month'=>''
> )
> );
> if ($input->isValid()) {
> echo "input is valid\n" ;
> } else {
> print_r($input->getMessages());
> }
>
>
> Output when I run this in 1.7.8:
>
> Array
> (
> [month] => Array
> (
> [isEmpty] => my custom message: this is empty yo
> [stringEmpty] => '' is an empty string
> )
>
> )
>
> Output when I run this in 1.9.0: (undesired):
>
>
> Array
> (
> [month] => Array
> (
> [isEmpty] => You must give a non-empty value for field 'month'
> )
>
> )
>
> I am having this problem with several Zend validation classes, not just
> Zend_Validate_NotEmpty. Any help is much appreciated.
>
> --
> David Mintz
> http://davidmintz.org/
>
> The subtle source is clear and bright
> The tributary streams flow through the darkness
>


Re: [fw-general] User uploads file bigger than what's allowed in php.ini, can it be caught?

2009-10-12 Thread Ryan Lange
This is an old thread, but I noticed that no one actually hit upon the
*real* problem.

On Mon, Feb 16, 2009 at 7:28 AM, bytte  wrote:

>
> Bug in my code or bug in Zend Framework?
>

Neither. It's an unfortunate short-coming of PHP itself.

http://us3.php.net/manual/en/ini.core.php#ini.post-max-size : "If the size
of post data is greater than post_max_size, the $_POST and $_FILES
superglobals are empty."

Files are uploaded as post data. If the file being uploaded pushes the post
data beyond the size allowed in php.ini, you get empty $_POST and $_FILES
superglobals, which is why ZF complains about not being able to find your
file field.


Re: [fw-general] Split controller actions into multiple classes

2009-09-22 Thread Ryan Chan
Hello,

On Mon, Sep 21, 2009 at 9:55 PM, Matthew Weier O'Phinney
 wrote:
>> If it is repetitive presentation logic you could sub-class the
>> Zend_Controller_Action or create action helpers if the repeating logic are
>> "cross cutting concerns". Keep in mind the saying is "fat model thin
>> controller" not just "thin controller"
>

For example, do you think the following code is a "thick controller"?
and difficult to manage?

http://howachen.googlepages.com/test.php


For me, it is.
It would be better to manage if each action is in a separate PHP class
file, isn't?


Re: [fw-general] Split controller actions into multiple classes

2009-09-18 Thread Ryan Chan
Hello,




On Fri, Sep 18, 2009 at 9:48 PM, Sudheer Satyanarayana
 wrote:
> On Friday 18 September 2009 07:10 PM, Ryan Chan wrote:
>>
>
> Consider splitting your code into multiple controllers and perhaps modules.
> Do you have model classes by the way?


Consider the following design.

Model class:
=
User

Controller:
=
Auth

Actions:
=
Registration
Login
Logout
ResetPassword
EmailVerification


as you can see, even I put a lot of code in model - User, that are
still too many action in auth controller.

Thanks...


[fw-general] Split controller actions into multiple classes

2009-09-18 Thread Ryan Chan
Hello,

I have a controller that contains too many line of codes, which made
the controller too large.

So I want to split each action into eactly one class files.

Is it recommended? If not, what are the recommended way to make the
controller "thin"?

Thanks.


[fw-general] Why serialize twice for Zend_Cache?

2009-09-08 Thread Ryan Chan
Hello,

I am using Zend_Cache with Zend_Cache_Backend_Memcached (which is
using php_memcache) extension.

Since the php_memcache extension already do serialization
automatically, but  Zend_Cache would need me to serialize me before
saving into cache, so this turn out that the data actually stored in
memcached was serialize twice times.

Anyone got the same experience.


Thanks.


[fw-general] Lazy loading of Zend DB

2009-08-14 Thread Ryan Chan
Hello,


I followed the tutorial at:
http://framework.zend.com/docs/quickstart/create-a-model-and-database-table

However, I am using pdo_mysql.

It seems that if I put db setting,

>> resources.db.adapter   = xxx


 in the application.ini config, even my controller action don't need
the database query, the zfw still need to create connection to the DB?

Is it possible to connect only if needed?


Thanks.


[fw-general] Put each action in a separate PHP file?

2009-08-08 Thread Ryan Chan
Hello,

As a ZFW learner, I tried the quick start:
http://framework.zend.com/docs/quickstart/create-a-form

My problem is when the controller contains many action - it make the
file too large to edit.

So I want to split each action into a separate PHP file, is it possible?


Thanks...


Re: [fw-general] Unit Testing ZFW

2009-08-08 Thread Ryan Chan
Hello,

On Mon, Aug 3, 2009 at 10:08 PM, Tim Fountain wrote:
> When you increased the memory limit, did the error above change to "Allowed
> memory size of  1073741824 bytes exhausted..."? If not, remember that the
> command line version of PHP has its own php.ini file, so make sure you're
> editing the correct one.
>
> --


Yes, when memory is increased to 1GB, then it will die at another place.

I have verified my memory setting using php -i | grep memory


Anyone can run the unit test successfully?


[fw-general] Unit Testing ZFW

2009-08-03 Thread Ryan Chan
Today I have downloaded 1.9. ZFW.

I want to test its by running...

 php -f AllTests.php

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to
allocate 7680 bytes)
in /home/ZendFramework/tests/Zend/Config/Writer/XmlTest.php on
line 54

I have checked my php.ini - memory limit is 32M.

Even I increased the value to 1GB, memory exhausted still exist,
anything I missed?


Thanks.


Re: [fw-general] Zend Framework 1.9.0 Released!

2009-07-31 Thread ryan
I, for one, have really been looking forward to this release. Speaking as
one of the folks that started using ZF back in 0.2, it really has come a
long way.

Kudos to everyone. Many of us would still be using  if it weren't for
you guys.


> The Zend Framework team announces the immediate availability of version
> 1.9.0!
>
> http://framework.zend.com/download/latest
>
> Kudos and thanks go out to the huge number of community contributors who
> helped make this release possible. This release has been almost entirely
> community driven, with the Zend team contributing primarily feature
> additions to existing components and working on maintenance of the
> project. If you submitted an issue report, a documentation improvement,
> a patch, a documentation translation, or a component, let it be known
> that you helped make this release what it is!
>
> The big stories in this release can be summed up in two phrases:
> enterprise tools and PHP 5.3 support.
>
> With Zend Framework making inroads to Enterprises, it's not surprising
> that we are seeing a number of components geared towards the Enterprise.
> In this release, we add two new components -- Zend_Queue and
> Zend_Test_PHPUnit_Db -- as well as additions to existing components --
> Zend_Ldap, Zend_Rest_Route, and Zend_Db_Adapter_Sqlsrv -- that target
> such development. Zend_Queue provides a common API for interacting with
> queue services such as Apache's ActiveMQ, MemcacheQ, and Zend Platform's
> Job Queue. Zend_Test_PHPUnit_Db brings DBUnit support to our Zend_Test
> offering, and provides integration with Zend_Db. Our Zend_Ldap support
> is now much more robust, and allows connectivity with MS ActiveDirectory
> and Novell's eDirectory, as well as full CRUD and tree manipulation
> options. Zend_Rest_Route allows developers to quickly develop RESTful
> MVC applications, which are increasingly gaining traction when serving
> public APIs. Zend_Db_Adapter_Sqlsrv interfaces with Microsoft's SQL
> Server driver for PHP.
>
> A month ago, the PHP team released the long-awaited PHP 5.3, which
> offers many improvements to the object model, as well as increased
> performance. Upgrading to PHP 5.3 is mostly straightforward, but, as
> with any release of this magnitude, sometimes takes some work. We have
> carefully audited our code and combed through our testbed in order to
> provide first-class compatibility for PHP 5.3 in Zend Framework -- while
> simultaneously continuing to support PHP 5.2.4 and above. Using Zend
> Framework on PHP 5.2 or 5.3 should be seamless and pose no issues for
> developers.
>
> New features in Zend Framework 1.9.0 include:
>
>  * Zend_Queue and Zend_Service_Amazon_Sqs, which provide the ability to
>use local and remote messaging and queue services for offloading
>asynchronous processes. (Contributed by Justin Plock and Daniel Lo)
>
>  * Zend_Queue_Adapter_PlatformJobQueue, a Zend_Queue adapter for Zend
>Platform's Job Queue. (Contributed by Zend Technologies)
>
>  * Zend_Rest_Route, Zend_Rest_Controller, and
>Zend_Controller_Plugin_PutHandler, which aid in providing RESTful
>resources via the MVC layer. (Contributed by Luke Crouch,
>SourceForge)
>
>  * Zend_Feed_Reader, which provides a common API to RSS and Atom feeds,
>as well as extensions to each format, caching, and a slew of other
>functionality. (Contributed by Pádraic Brady and Jurrien Stutterheim)
>
>  * Zend_Db_Adapter_Sqlsrv, a Zend_Db adapter for Microsoft's SQL Server
>driver for PHP. (Contributed by Juozas Kaziukenas and Rob Allen)
>
>  * Zend_Db_Table updates to allow using Zend_Db_Table as a concrete
>class by passing it one or more table definitions via the
>constructor. (Contributed by Ralph Schindler)
>
>  * Zend_Test_PHPUnit_Db, which provides Zend_Db support for PHPUnit's
>DBUnit support, allowing developers to do functional and integration
>testing against databases using data fixtures. (Contributed by
>Benjamin Eberlei)
>
>  * Annotation processing support for Zend_Pdf, as well as performance
>improvements. (Contributed by Alexander Veremyev)
>
>  * Zend_Dojo custom build layer support. (Contributed by Matthew Weier
>O'Phinney)
>
>  * Dojo upgraded to 1.3.2.
>
>  * Numerous Zend_Ldap improvements, including full support for CRUD
>operations, search, and manipulating tree structures. (Contributed by
>Stefan Gehrig)
>
>  * Zend_Log_Writer_Syslog, a Zend_Log writer for writing to your system
>log. (Contributed by Thomas Gelf)
>
>  * Zend_View_Helper_BaseUrl, a view helper for returning the current
>base URL to your application, as well as for constructing URLs to
>public resources. (Contributed by Robin Skoglund and Geoffrey Tran)
>
>  * Zend_Date now has support for the DateTime extension. (Contributed by
>Thomas Weidner)
>
>  * Zend_Locale has been upgraded to CLDR 1.7. (Contributed by Thomas
>Weidner)
>
>  * Zend_Translate now has plurals support for the Gettext, Csv

Re: [fw-general] Return last inserted id

2008-12-11 Thread Ryan Mauger

$row->save() returns the primary key value of the row.
so try:
return $row->save();

Ryan Mauger

Daniel Latter wrote:

Hi,

How can I get the last inserted ID from a newly inserted row?

My class extends Zend_Db_Table and uses code similar to:

$row = $this->createRow();
$row->title = $feedDetails['feedTitle'];
$row->description  = $feedDetails['feedDesc'];;
$row->link  = $feedDetails['feedLink'];
$row->save();
return $this->lastInsertId(); <-- this doesnt work

I would be grateful if someone could let me know what I'm doing wrong,?

I have seen in the docs this:

$db->->lastInsertId(), but can I access the same or similar from my 
class that extends Zend_Db_Table.


Thank You
Daniel Latter


[fw-general] Zend_ProgressBar (Ideas?)

2008-12-10 Thread Ryan Brooks
Howdy folks, 

I have to confess that I am truly pleased with Zend_ProgressBar. However, I
had a couple thoughts once I actually started using it. I am sending this
message to the mailing list because I'm not entirely sure it is within the
scope/context of Zend_ProgressBar.

I wonder if it's not a good idea to allow single instances of ZPB
(namespaces). For instance, in my case I'm doing a search index rebuild of
a large resultset. In particular I flush my index tables, fetch all my
records and insert the index values into one table and the relations to
another.

However, I'd like this process to be running a single instance at a time.
For example, if I request /resource/intense/rebuild-search-index/, the
process will start. However, if I request it again, I'd like the process to
not start again, but update with the current progress. I had already
considered adjusting Zend_ProgressBar::$_min to use
Zend_ProgressBar::$_current as an offset, but in this particular case I
don't think it applies. I'm including some code as an example.

One caveat I can think of is sharing process information across
sessions/users, so it may be a good idea to pass in a cache object, or
explicitly define a cache prefix? I also don't think this would be
considered adapter functionality, as it seems fairly global to
Zend_ProgressBar.

Other potential usage scenarios would be converting a video from one type
to another, or converting a CMYK image to RGB (using a filename as a
prefix), etc. 

The methods I propose (though their functionality, names and usage aren't
in stone, I leave that to the devs) include:

setSingleInstance() // sets ZPB to allow a single instance of a progress
bar, cross user
setCacheInstance() // Either setting a Zend_Cache instance, or just a
namespace
setIgnoreUserAbort() // sets ignore_user_abort() - just a thought, not sure
if it is needed
isIdle() // Returns (bool) where singleInstance is registered (but not
running?)
isRunning() // returns (bool) if running
getCurrent() // Current record convenience method
removeCache() // flushes the cache object
rewind() // Potentially not the best method name, but it would flush the
cache, reset user abort, etc.

Just let me know if I'm out of my mind!

Thanks folks,

-Ryan

 true);
$backendOptions  = array(
'cache_dir' => 'cache/progressbar',
'file_name_prefix' => 'myNamespace'
);
$this->_cacheObj = Zend_Cache::factory('Core', 'File', 
$frontendOptions,
$backendOptions);
}
private function _exampleRecordList()
{
if(!$records = $this->_cacheObj->load('index_process'))
{
$records =
IndexFactory::getInstance()->fetchLargeResultsetForReindexing('*');
$this->_cacheObj->save($records, 'index_process');
}
return $records;
}
public function indexAction()
{
// ...
}
public function rebuildSearchIndexAction()
{
$this->noRender();
if (isset($_GET['progress']))
{
$rows = $this->_exampleRecordList();
$cnt = count($rows);
$adapter = new
Zend_ProgressBar_Adapter_JsPush(array('updateMethodName' =>
'Zend_ProgressBar_Update', 'finishMethodName' =>
'Zend_ProgressBar_Finish')); 
$progressBar = new Zend_ProgressBar($adapter, 0, $cnt, 
'index_Process');

$progressBar->setSingleInstance('my_namespace') // Or 
true, and use
_persistenceNamespace as a namespace adapter. It would allow single
instances of multiple namespaces
->setCacheInstance($this->_cache)
->setIgnoreUserAbort();
try
{
if($progressBar->isIdle() === (bool) TRUE)
{
do {
$runningStatus = 
$progressBar->isRunning();
$currentRecord = 
$rows[$progressBar->getCurrent()];

Records_IndexFactory::getInstance()->insertSearchIndex($currentRecord,
'my_large_search_index');
$text = "Starting record 
$currentRecord of $cnt";

$progressBar->update($currentRecord, $text); 
usleep(10);
  

[fw-general] Unescaping Form Select Option Values

2008-07-11 Thread Ryan Mannion
For the purposes of creating a "cascading" list in a select, I'd like
to prepend select options values with non-breaking spaces ( ).
Because the select options value attribute is automatically escaped
(and from a cursory look at the Zend sources, it appears it's not
possible to turn this off), the  s appear as " " instead of
an actual space.

I tried using chr(160) in place of " ", but am seeing question
marks in my browser instead of spaces. Please note that I have my
charset set as utf-8 in case that's relevant.

It looks like I may need to write my own ViewHelper. Any thoughts on
other workarounds?

Ryan


RE: [fw-general] ZF Snapshots

2008-05-06 Thread Ryan Brooks
Thanks Wil! A checkout was my next step! I'll do that.

 

-Ryan

 

  _  

From: Wil Sinclair [mailto:[EMAIL PROTECTED] 
Sent: May 6, 2008 6:58 PM
To: Ryan Brooks; Zend Framework (General List)
Subject: RE: [fw-general] ZF Snapshots

 

Some of the scripts that we run on our servers broke when we migrated all ZF
systems last week. I believe the script that creates the snapshots was one
of them. We should have this resolved in the next few days. In the meantime,
you might consider checking out trunk using SVN.

 

Thanks for the patience!

,Wil

 

From: Ryan Brooks [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 06, 2008 5:52 PM
To: Zend Framework (General List)
Subject: [fw-general] ZF Snapshots

 

I might have missed an update during the weekend, but currently the nightly
builds are 404ing on me. Any idea when these will be back up?

Ryan Brooks
Web Developer & Technophile
 <http://www.zed23.com/> zed23.com 

 



[fw-general] ZF Snapshots

2008-05-06 Thread Ryan Brooks
I might have missed an update during the weekend, but currently the nightly
builds are 404ing on me. Any idea when these will be back up?

Ryan Brooks
Web Developer & Technophile
 <http://www.zed23.com/> zed23.com 

 



[fw-general] Webinar - Thanks!

2008-04-30 Thread Ryan Brooks
Howdy folks, 

 

Just wanted to extend my gratitude to the ZF team for putting the webinar
together; some very cool discussion and questions.

 

Also want to pose the question: anyone blogging about it now that it is
over?

Ryan Brooks
Web Developer & Technophile
 <http://www.zed23.com/> zed23.com 

 



RE: [fw-general] Our new Zend Framework Architect

2008-04-07 Thread Ryan Brooks
Can I have his old job? ;)

I kid. Seriously though, I for one am please that Matthew is moving up! Way
to climb the corporate ladder.

Course, you know Matthew that now we'll all be expecting bigger and better
things!

-Ryan

-Original Message-
From: Wil Sinclair [mailto:[EMAIL PROTECTED] 
Sent: April 7, 2008 2:36 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Our new Zend Framework Architect

> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/

Yikes! I knew there was something I forgot to do on Friday. Without
further ado, it's my immense pleasure to announce that Matthew has been
promoted to Software Architect at Zend. I'm sure I don't have to explain
what he's done to deserve this here. ;)
He'll still maintain his existing components and develop new components.
But he'll also be heading up efforts that involve cross-cutting concerns
with all components. The general consistency of design and quality
across all components should benefit greatly from his attention.
In addition, he will be heading up the initiative to define exactly what
we'll be doing for the 2.0 release. This is of course a critical role as
we make the right tradeoffs between improvements and backwards
compatibility.
Congrats Matthew!

,Wil



Re: [fw-general] Zend_Form and slashes

2008-03-31 Thread Ryan Brooks

Not that I want to contradict Matthew, but last I checked magic_quotes_gpc 
can't be set at runtime.

Try setting it in your php.ini, or alter your .htaccess file with:
php_value magic_quotes_gpc off

-Ryan

On Mon, 31 Mar 2008 22:15:52 -0400, Matthew Weier O'Phinney <[EMAIL PROTECTED]> 
wrote:
> -- dowker <[EMAIL PROTECTED]> wrote
> (on Monday, 31 March 2008, 02:32 PM -0700):
>> I have the following code in IndexController.php. If I submit the form
> with
>> the value "Help's Needed!" (without the double quotes) in "Field 1", the
>> form will fail validation (because "Field 2" is empty), and will
> repopulate
>> "Field 1" with "Help\'s Needed!" (without the double quotes). Aren't the
>> slashes stripped by Zend_Form? If not, What's the best way to filter
> them
>> out? Thanks.
> 
> Best way? Turn off magic_quotes_gpc.
> 
> Zend_Form isn't adding them; PHP is, because that setting is on. Turn it
> off early in your bootstrap:
> 
> ini_set('magic_quotes_gpc', false);
> 
> (Most default configurations have this off currently, for this very
> reason.)
> 
> --
> Matthew Weier O'Phinney
> PHP Developer| [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
--
http://www.zed23.com/



RE: [fw-general] ZF Packaging

2008-01-22 Thread ryan

I would prefer not to use PEAR. Seems like a silver bullet solution to me... I 
have an anal-retentive need to know exactly what is going on in my projects.

Doesn't mean that PEAR doesn't work for the rest of you, but I would like to 
continue to download it, unpack it and move it myself.

On Tue, 22 Jan 2008 16:01:05 -0800, "Wil Sinclair" <[EMAIL PROTECTED]> wrote:
> Actually, I'm a bit ignorant since I'm a relative PHP newbie, but let me
> turn that question around- why would a PEAR channel be a good way to
> distribute ZF? That is, considering the current ZF installation is
> basically download, decompress, and update include path, what does PEAR
> bring to the table that I'm missing?
> 
>  
> 
> ,Wil
> 
>  
> 
> From: Bryce Lohr [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, January 22, 2008 2:13 PM
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] ZF Packaging
> 
>  
> 
> I second the request for PEAR channel. Is there any reason why that would
> not be a good way to distribute the framework?
> 
> Regards,
> Bryce Lohr
> 
> 
> Pádraic Brady wrote: 
> 
> Hi Will,
> 
> It sounds good - an optional lean package would frighten off far less
> prospective users who have heard tales about HDD's dying from the strain of
> downloading the ZF ;).
> I would still like to see a PEAR channel emerge at some point though -
> that may be a fanciful concept but I gather from the last paragraph
> something along those lines is under consideration?
> Hope someone comes up with colourful names for these variants!
> 
> Best regards,
> Paddy
> 
>  
> 
> Pádraic Brady
> 
> http://blog.astrumfutura.com
> http://www.patternsforphp.com
> OpenID Europe Foundation  
> 
>  
> 
> - Original Message 
> From: Wil Sinclair <[EMAIL PROTECTED]>  
> To: fw-general@lists.zend.com
> Sent: Tuesday, January 22, 2008 8:36:39 PM
> Subject: [fw-general] ZF Packaging
> 
> As part of the 1.5 release process, we've been reviewing the size of our
> distribution package and what contributes the most weight. We've
> determined that there are a few 'heavyweights' that we currently have in
> the zips/tarballs that many- if not most- users will never need. These
> include the unit tests, the demos, and the locale files (currently
> consuming ~8MB uncompressed on my hdd :O). With these components, the
> 1.0.3 release is ~5.3MB compressed on my hdd. We would like to
> distribute, starting with the 1.5 RC1, a 'lean and mean' ZF package
> alongside the 'everything' package. The 'lean and mean' package would
> not contain the tests, demos, locale files, or extras. 'Everything'
> would include, well, everything- even docs in html format. To facilitate
> access to the omissions from the 'lean and mean' release, we would
> provide a download action for the CLI tool so they can be retrieved and
> installed in the correct place with a single command.
> Thomas can give more details about how the locale-aware components would
> behave in this proposal.
> Thoughts?
> 
> Thanks.
> ,Wil
> 
>  
> 
> 
> 



Re: [fw-general] php|architect's Guide to Programming with ZF - Should I?

2008-01-21 Thread ryan

Not exactly new (been using since 0.2)... I saw your comments on ZF guide; is it
worthwhile buying for those that aren't new to it?

On Mon, 21 Jan 2008 17:47:05 +0100, "Christian Schmidt" <[EMAIL PROTECTED]> 
wrote:
> On Jan 21, 2008 5:26 PM,  <[EMAIL PROTECTED]> wrote:
>>
>> Hi guys,
>>
>> It seems to be out now.
>>
>> http://www.phparch.com/c/books/id/9780973862157
>>
>> Just wondering if you all have looked at it, and if it is worth the
> purchase.
> 
> I bought the book and already posted a comment on the books website
> (zfguide.com)
> 
> If you are new to ZF it is a good point to start with.
> 
> regards,
> 
> Chris



[fw-general] php|architect's Guide to Programming with ZF - Should I?

2008-01-21 Thread ryan

Hi guys,

It seems to be out now.

http://www.phparch.com/c/books/id/9780973862157

Just wondering if you all have looked at it, and if it is worth the purchase.

-Ryan



Re: [fw-general] Subclassing Zend_Controller_Action, possible ?

2008-01-18 Thread ryan

abstract class YourSubController extends Zend_Controller_Action
{
public function init()
{
// ... 
}
}



On Fri, 18 Jan 2008 16:27:38 + (UTC), Juan Felipe Alavarez Saldarriaga 
<[EMAIL PROTECTED]> wrote:
> Hey :)
> 
> Question, is there a way to sub-classing the Zend_Controller_Action, I
> mean, I need to set some variables and objects in the init() method for all
> the controllers that I have, is that possible ?
> 
> Thx for any help.



Re: [fw-general] Zend Framework 1.5 Preview Release schedule

2008-01-10 Thread ryan

Matthew,

Thanks a lot for the breakdown. It gives me something I can send to my staff in 
a form they'll understand!!! I check the proposals regularly (in the hopes that 
Zend_Services_Amazon_S3 will get attention) but this answers my question. 

Can't wait to toy with Zend_Build & Zend_Console.

-Ryan

PS: Wil, thanks for your response, I'll be sure to keep a closer eye on the 
issue tracker.

On Thu, 10 Jan 2008 15:26:03 -0500, Matthew Weier O'Phinney <[EMAIL PROTECTED]> 
wrote:
> -- [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote
> (on Thursday, 10 January 2008, 01:03 PM -0600):
>> Perhaps I shouldn't be asking this via this forum, but is it possible
>> to get an outline of what we can expect in 1.5? I checked the Zend
>> Blog, and it tells us high level stuff like 'command line tooling,
>> forms, and authentication' - is there anything you can tell us folk
>> who use the framework daily yet don't watch the commits too closely?
> 
> Okay, off the top of my head, new and/or improved components include:
> 
>   * Zend_Auth_Adapter_Ldap
>   * Zend_Build/Zend_Console
>   * Zend_Controller additional action helpers
> * ContextSwitch and AjaxContext
> * Json
> * AutoComplete
>   * Zend_Form
>   * Zend_InfoCard
>   * Zend_Layout
>   * Zend_OpenId
>   * Zend_Search_Lucene improvements and bugfixes
>   * Zend_View enhancements:
> * actions
> * partials
> * placeholders
>   * New Zend_Service consumables (not sure which ones will be final)
> 
> I'm sure there's more, but, as I said, that's off the top of my head. A
> good place to look is on the wiki proposals page (look at what's
> currently in the incubator, and see what core proposals may be present
> that you haven't seen before), and also in the issue tracker.
> 
> 
>> If not, I as well as others eagerly anticipate the new release!
>>
>> -Ryan
>>
>> On Thu, 10 Jan 2008 13:33:19 -0500, Darby Felton <[EMAIL PROTECTED]> wrote:
>> > Hi all,
>> >
>> > It's that time again when Zend Framework is ramping up for another
>> > release, and this one is shaping up to be quite significant. New
>> > features that were not merged to the release-1.0 branch and were not
>> > included with mini-release versions (i.e., 1.0.1, 1.0.2, and 1.0.3)
> will
>> > be included with this next release, Zend Framework 1.5 Preview
> Release.
>> >
>> > The purpose of this message is to let developers know of the currently
>> > planned schedule for the release.
>> >
>> > The code freeze for this release is planned for Tuesday, January 22 at
>> > 21:00 (PST). Upon commencement of the code freeze, nothing should be
>> > merged to the upcoming 1.5 release branch without approval from one of
>> > the Zend team (Alex, Matthew, Wil, or myself). Development may of
> course
>> > continue in the trunk as usual, and the release branch code freeze
> would
>> > be lifted as soon as the release is made available. :)
>> >
>> > Thank you all for contributing to Zend Framework and making these
>> > releases possible! :)
>> >
>> > Best regards,
>> > Darby
>>
> 
> --
> Matthew Weier O'Phinney
> PHP Developer| [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/



Re: [fw-general] Zend Framework 1.5 Preview Release schedule

2008-01-10 Thread ryan

Darby,

Perhaps I shouldn't be asking this via this forum, but is it possible to get an 
outline of what we can expect in 1.5? I checked the Zend Blog, and it tells us 
high level stuff like 'command line tooling, forms, and authentication' - is 
there anything you can tell us folk who use the framework daily yet don't watch 
the commits too closely?

If not, I as well as others eagerly anticipate the new release!

-Ryan

On Thu, 10 Jan 2008 13:33:19 -0500, Darby Felton <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> It's that time again when Zend Framework is ramping up for another
> release, and this one is shaping up to be quite significant. New
> features that were not merged to the release-1.0 branch and were not
> included with mini-release versions (i.e., 1.0.1, 1.0.2, and 1.0.3) will
> be included with this next release, Zend Framework 1.5 Preview Release.
> 
> The purpose of this message is to let developers know of the currently
> planned schedule for the release.
> 
> The code freeze for this release is planned for Tuesday, January 22 at
> 21:00 (PST). Upon commencement of the code freeze, nothing should be
> merged to the upcoming 1.5 release branch without approval from one of
> the Zend team (Alex, Matthew, Wil, or myself). Development may of course
> continue in the trunk as usual, and the release branch code freeze would
> be lifted as soon as the release is made available. :)
> 
> Thank you all for contributing to Zend Framework and making these
> releases possible! :)
> 
> Best regards,
> Darby



Re: [fw-general] Zend_Mail Bug?

2008-01-02 Thread Ryan Lange

Jacky Chen wrote:

Hi Simone,
 
the code for sending emails are following:
 

$tr = new Zend_Mail_Transport_Smtp($mailConfig->host, 
$mailConfig->options->toArray());

Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail('utf8');

$mail->setBodyHtml($body);
$mail->setBodyText($body);
$mail->setFrom($mailConfig->from, $mailConfig->sender);
$mail->addTo($email);
$mail->setSubject($subject);
try {
$mail->send();
return true;
} catch (Exception $e) {
return false;
}

and the subject and body contains Chinese characters.


Shouldn't the character encoding in the line...

   $mail = new Zend_Mail('utf8');

...be 'utf-8' (with the dash), not 'utf8'?


Re: [fw-general] Zend_Cache & simplexml_load_file( )

2007-12-12 Thread ryan

David,

I'm an idiot. Apparently I wasn't thinking that part through. Heh.

Thanks a lot, problem solved.

-Ryan

On Wed, 12 Dec 2007 16:44:32 +, David Goodwin <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> 
>> To be clear, everything works as expected if I omit the caching, so I
>> am confident it is not a problem with the feed. I could cache the
>> view, but I really don't want to do that.
>>
>> Anyone have any thoughts?
>>
>> -Ryan
>>
> 
> You can't normally serialise native PHP objects, so perhaps you need to
> explicitly call '$simplexml->asXML()' and cache that (the xml string),
> and re-create the simplexml object manually from the cache?
> 
> 
> David.
> - --
>  David Goodwin  Pale Purple Limited
>  Office: 0845 0046746   Mobile: 07792380669
>  http://www.palepurple.co.ukCompany No: 5580814
>  'Business Web Application Development and Training in PHP'
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFHYA/w/ISo3RF5V6YRAoI1AKDR5J+klAKLIBf/B6Q8zXFxTzbwUgCdFz6M
> R0eSlZWWdV/N0T2O7KCKSqA=
> =brBa
> -END PGP SIGNATURE-



[fw-general] Zend_Cache & simplexml_load_file()

2007-12-12 Thread ryan

Hi guys, 

(Please forgive me if I've used the wrong mailing list.)

I was hoping someone can help me figure something out. I am trying to cache an 
object of simpleXml, obtained by parsing a third party stocks feed. It seems 
relatively straight-forward but for some reason I can save the result fine, but 
can't load it.

class IndexController extends BootstrapController
{
private $frontendOptions = array(
'lifetime' => 500,
'automatic_serialization' => FALSE // Tried playing 
with TRUE/FALSE
);
private $backendOptions = array(
'cache_dir' => './cache/xml',
'file_name_prefix' => 'cache',
);
public function init()
{
parent::init();
}
public function indexAction()
{
$method = (string) "indexStocks";
$cache = Zend_Cache::factory('Core', 'File', 
$this->frontendOptions, $this->backendOptions);  // Tried playing with options
if(!$this->view->xmlFeed = $cache->load($method))
{
$feed = simplexml_load_file('MY FEED'); // IP 
RESTRICTED FEED
$cache->save($feed, $method);
$this->view->xmlFeed = $feed;
}
$this->render();
}
}

To be clear, everything works as expected if I omit the caching, so I am 
confident it is not a problem with the feed. I could cache the view, but I 
really don't want to do that.

Anyone have any thoughts?

-Ryan



[fw-general] Problem with removeDefaultRoutes() and default error handling

2007-11-29 Thread Ryan Lange
In this project I'm working on I want to strictly control which routes are
valid for the application. At the moment, I have three controllers:
IndexController, ClientController, and ErrorController. I've set up 3
routes, like so:

addRoute( 'client_list', new Zend_Controller_Router_Route(
'clients', [snipped] ) );
$router->addRoute( 'client_view', new Zend_Controller_Router_Route(
'client/:id', [snipped] ) );
$router->addRoute( 'client_edit', new Zend_Controller_Router_Route(
'client/:id/edit', [snipped] ) );

?>

I also set the router with the front controller's setRouter() method. With
the above setup, I can navigate to example.com/fake/ and will get the
expected, and custom, error message.

However, if I remove the default routes...

removeDefaultRoutes();
$router->addRoute( 'client_list', new Zend_Controller_Router_Route(
'clients', [snipped] ) );
$router->addRoute( 'client_view', new Zend_Controller_Router_Route(
'client/:id', [snipped] ) );
$router->addRoute( 'client_edit', new Zend_Controller_Router_Route(
'client/:id/edit', [snipped] ) );

?>

...navigating to example.com/fake/ no longer invokes the expected error
message, but instead invokes the "index" action of IndexController.

Is this a bug, or am I missing something?

Thanks,
Ryan Lange


[fw-general] How are you using Zend_Filter_Input?

2007-10-26 Thread Ryan Lange
I'm curious how others are using the current (as of ZF 1.0.2) 
implementation of Zend_Filter_Input. I'm trying to use it for a contact 
form, but everything I've typed out seems clumsy and overly complicated. 
(Maybe that's just the cost of flexibility, though, because even the 
"less basic" examples in the documentation look extremely convoluted.)


For instance, I have one hidden field (using CSS) on the form that's 
used in spam detection. This field needs to remain completely untouched 
by the filters I set, but in order to do that, I have to explicitly 
assign the filters to /every/ other field (14 of them) rather than use 
the "*" wildcard.


Also, I have no clue how to handle multiple fields of the same name. 
This same contact form allows the user to provide their phone number if 
they wish. This consists of 4 fields that represent parts of a U.S. 
telephone number, all with the name "phone[]": ([___]) [___]-[] ext. 
[_]


If any one can provide any insight or examples of their own of their, 
that'd be great.



Thanks,
Ryan Lange


Re: [fw-general] thought experiment: standalone app module within an app

2007-10-03 Thread Ryan Brooks

David,

As with all things in our line of work, the answer is 'Well, it depends'. I 
think the biggest problem you should consider is namespaces (or lack thereof). 
If you try to plan for a potential migration and attempt to forecast the 
problems you'll have, I don't think you'll have too many issues.

-Ryan

On Wed, 3 Oct 2007 16:06:15 -0400, "David Mintz" <[EMAIL PROTECTED]> wrote:
> Hello
> 
> I am thinking I need to develop my project as a standalone, independent ZF
> app but later might want it to become a module within a larger app. How
> hellish could that conversion process be? In my imagination, I think "not
> too terribly hellish" but maybe you guys know otherwise.
> 
> Thanks.
> 
> 



Re: [fw-general] using Zend_Auth with a custom Sessio n Save Handler ?

2007-09-24 Thread Ryan Brooks

I would like to say that I've been using this for some time as well, and it 
works splendidly.

/2c

-Ryan

On Mon, 24 Sep 2007 12:57:59 -0700 (PDT), Jordan Raub <[EMAIL PROTECTED]> wrote:
> Sweet! I thought this went to the wayside. I've been using it too on my
> stuff with no problems. Do you think this could make it into the trunk
> soon? Here is the link to the proposal too
> http://framework.zend.com/wiki/display/ZFPROP/Zend_Session_SaveHandler_DbTable
>  
> Thanks,
> Jordan 
> He that teaches himself hath a fool for his master. -- Benjamin Franklin
> Poor is the pupil who does not surpass his master. -- Leonardo da Vinci.
> 
> - Original Message 
> From: Simon Mundy <[EMAIL PROTECTED]>
> To: Truppe Steven <[EMAIL PROTECTED]>
> Cc: fw-general@lists.zend.com
> Sent: Saturday, September 22, 2007 7:10:53 PM
> Subject: Re: [fw-general] using Zend_Auth with a custom Session Save
> Handler ?
> 
> The Zend_Session_SaveHandler_DbTable component is tucked away in the
> incubator - I've had it running now for the last couple of weeks in
> combination with Zend_Auth and it's been working wonderfully. It's been
> used in conjunction with a series of linked microsites using different
> subdomains and this approach has been the most effective way for me to
> manage sessions smoothly across them all (especially if I decide to
> offload my database and sessions to a standalone server down the track).
> 
> First you set up your session table. Here's my MySQL dump (nearly
> identical to the example shown on the proposal page for
> Zend_Session_SaveHandler_DbTable):-
> 
> 
> CREATE TABLE `session_list` (
>   `id` varchar(32) collate utf8_unicode_ci NOT NULL,
>   `save_path` varchar(32) collate utf8_unicode_ci NOT NULL,
>   `name` varchar(32) collate utf8_unicode_ci NOT NULL default '',
>   `modified` int(11) default NULL,
>   `lifetime` int(11) default NULL,
>   `data` text collate utf8_unicode_ci,
>   PRIMARY KEY  (`id`,`save_path`,`name`)
> ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci PACK_KEYS=1;
> 
> 
> Here's an example of my config.ini file:-
> 
> 
> [all]
> 
> 
> ;
> -
> ; Database connection
> ;
> -
> db.connection = pdo_mysql
> db.host = localhost
> db.username = myusername
> db.password = mypassword
> db.dbname = mydatabase
> 
> 
> ;
> -
> ; Session
> ;
> -
> session.cookie_domain = mydomain.com.au
> session.name = mycustomsessionname
> session.remember_me_seconds = 864000
> session.use_only_cookies = on
> 
> 
> sessionhandler.name = session_list
> sessionhandler.lifetime = 864000
> sessionhandler.primary = id
> sessionhandler.dataColumn = data
> sessionhandler.modifiedColumn = modified
> sessionhandler.lifetimeColumn = lifetime
> sessionhandler.overrideLifetime = true
> 
> 
> 
> This is how I set it up in my bootstrap:-
> 
> 
> // Set up database
> $db = Zend_Db::factory($config->db->connection, $config->db->toArray());
> Zend_Db_Table::setDefaultAdapter($db);
> 
> 
> // Set session defaults
> Zend_Session::setOptions($config->session->toArray());
> Zend_Session::setSaveHandler(new
> Zend_Session_SaveHandler_DbTable($config->sessionhandler->toArray()));
> 
> 
> And then continue to use Zend_Auth as you would normally.
> 
> 
> Note that the storage engine for Zend_Auth bears no relation to the
> session at all - this will be a completely separate table (if you're using
> database authentication).
> 
> 
> Hope this gets you on the way!
> 
> 
> Cheerio
> 
> Hi,
> 
> i have a class that implements Zend_Session_SaveHandler_Interface to
> save the session data inside a database. now i want this save handler to
> be used to store the identity after authentication.
> 
> in the manual i found this:
> 
> /By default, Zend_Auth provides persistent storage of the identity
> from a successful authentication attempt using the PHP session. Upon
> a successful authentication attempt, Zend_Auth::authenticate()
> stores the identity from the authentication result into persistent
> storage. Unless configured otherwise, Zend_Auth uses a storage class
> named Zend_Auth_Storage_Session, which, in turn, uses Zend_Session.
> A custom class may instead be used by providing an object that
> implements Zend_Auth_Storage_Interface to Zend_Auth::setStorage()./
> 
> What does that mean for the Zend_Session_SaveHandler implementation ? Is
> Zend_Auth_Storage_Interface the same interface ??
> 
> 
> I only found Zend_Session::setSaveHandler() but i have no idea how to
> use this in combination with Zend_Auth (because Zend_Auth handles
> Zend_Session internal).
> 
> I hope someone can help me with this.
> 
> best regards,
> Truppe Steven
> 
> 
> 
>  



Re: [fw-general] Jira is down...

2007-09-18 Thread Ryan Boyd
Jira issues again :(

---
Proxy Error

The proxy server received an invalid response from an upstream server.
 The proxy server could not handle the request GET
/issues/secure/BrowseProject.jspa.

 Reason: Error reading from remote server




On 9/17/07, till <[EMAIL PROTECTED]> wrote:
> On 9/17/07, Thomas Weidner <[EMAIL PROTECTED]> wrote:
> > Definitly not...
> >
> > I AM NOT THE FAULT !!
>
> You just work too much on it. :P C'mon, just admit it!!!
>
> Till
>


Re: [fw-general] Status of the Zend_Service_Amazon_S3 p roposal

2007-08-14 Thread Ryan Brooks

I too have been hoping to hear something about this, and was disappointed after 
seeing the comment Travis posted regarding lack of interest.

-Ryan

On Tue, 14 Aug 2007 16:50:50 +0200, Jean-Marc Fontaine <[EMAIL PROTECTED]> 
wrote:
> Hello,
> 
> I would like to know if the Zend_Service_Amazon_S3 proposal has been
> accepted and if not could someone review it, please ?
> 
> http://framework.zend.com/wiki/display/ZFPROP/Zend_Services_Amazon_S3+-+Travis+Swicegood?showComments=true&showCommentArea=true#addcomment
> 
> I need such a component and I guess I am not the only one.
> 
> Regards.
> 
> Jean-Marc
> 
> 
> Kanopée - Développement Informatique Durable
> 56 rue de Saint André
> 59800 Lille
> 
> Tél  : 03 20 74 61 25
> Portable : 06 88 56 50 79
> Fax  : 03 20 06 51 26
> Web  : http://www.kanopee.net/



Re: [fw-general] no php closing tag?

2007-08-11 Thread Ryan Brooks

This is actually a pretty common question.

Taken straight from the Zend Coding Standards (draft) seen at:
http://framework.zend.com/wiki/display/ZFDEV/PHP+Coding+Standard+(draft)

"For files that contain only PHP code, the closing tag ("?>") is to be omitted. 
It is not required by PHP, and omitting it prevents trailing whitespace from 
being accidentally injected into the output."

Generally, as such, it's a good idea to omit the closing tag in PHP files 
containing only PHP code (such as class files). For things like views, which 
are mixes of PHP and HTML, close all PHP.

This will prevent you from encountering trailing whitespace, which can be a bit 
of a headache.


On Sat, 11 Aug 2007 20:58:18 -0700, Stanislav Malyshev <[EMAIL PROTECTED]> 
wrote:
>> After going through the docs I realized that the examples with no end ?>
>> was not a typo. Is that for every php script that uses in the framework
> or
>> just the framework classes? Will something bad happen if you do use '?>'
>> ? How did that design decision come about?
> 
> Nothing bad happens if you use "?>". However, if you use "?>" and after
> it put some whitespace, something bad does happen - this whitespace gets
> output, and it might be output in wrong place at the wrong time. Since
> closing ?> is not required and anyway nothing is going to happen after
> ?>, many people omit it.
> --
> Stanislav Malyshev, Zend Software Architect
> [EMAIL PROTECTED]   http://www.zend.com/
> (408)253-8829   MSN: [EMAIL PROTECTED]



Re: [fw-general] Zend_Currency

2007-08-09 Thread Ryan Brooks

AWESOME!

On Thu, 9 Aug 2007 22:44:28 +0200, "Thomas Weidner" <[EMAIL PROTECTED]> wrote:
> Dear ZF Community,
> 
> the implementation of Zend Currency is finished and ready for the core.
> You
> can find it in the incubator (minimum release SVN 6048).
> 
> I would appreciate if some people would be willing to test the class.
> We have a testbed and also two chapters of documentation for this class.
> 
> If all tests are OK I would like to have this new component integrated
> within the release 1.1.0
> 
> Thanks to shreef for his initial implmentation.
> 
> Greetings
> Thomas
> I18N Team Leader



[fw-general] Error Handling w/ Zend DB

2007-07-25 Thread Ryan Graciano

I'm trying to handle errors appropriately after an insert into MySQL with
Zend_DB and the MySQLi plugin, but I'm having a rough time determining the
cause of the error.

For example, I'd like my application to catch the exception, determine if
the exception occurred due to a unique key violation, and then if so,
identify the column that is causing the violation.  I noticed that the type
of the exception returned is Zend_Db_Statement_Mysqli_Exception, and here's
all of the information I could get out of it -

getCode(): 0
getFile(): D:\Apache224\htdocs\CK\library\Zend\Db\Statement\Mysqli.php
getLine(): 237
getMessage(): Mysqli statement execute error : Duplicate entry '1' for key 1

Does this mean that I need to parse the message to determine exactly what
caused the exception, or is there some other way for me to perform error
handling w/ Zend DB?

Thanks,
- Ryan


[fw-general] quoteInto vs bound parameters

2007-07-20 Thread Ryan Graciano

I've been looking through the Zend_Db documentation, and I'm wondering why
you would ever want to use quoteInto() or quote() as opposed to binding your
parameters in an array.  What's the advantage to quoteInto()/quote()?  Isn't
the separation of data provided by bound parameters always going to be more
secure than attempting to manipulate the strings?  As I understand it, all
statements are prepared anyhow, so why not use more bound parameters?

For example, wouldn't bound parameters always avoid bizarre problems like
unicode SQL injections [http://bugs.mysql.com/bug.php?id=22243], whereas
with quote/quoteInto you're trusting the string parse to get it right?

I'm curious because it looks like relatively few methods (none?) in
Zend_Db_Table support bound parameters.  To use binding, I need to go to the
adapter every time, which makes my Zend_Db_Table class somewhat less
convenient.

I'm new to ZF, so maybe I'm just missing something really obvious here.  I'd
appreciate it if anyone could provide some insight.

Thanks,
- Ryan


Re: [fw-general] Error handling with mysqli adapter

2007-07-18 Thread Ryan Graciano

Thanks Eric - this was right on the money.  I found my answer here -

http://www.mail-archive.com/[EMAIL PROTECTED]/msg28759.html

I have a custom session handler that's actually doing the write, and it
looks like PHP is running it after the script is finished executing.  If I
move the same code into a normal block, I see a sane error message.

Thanks again,
- Ryan

On 7/18/07, Eric Coleman <[EMAIL PROTECTED]> wrote:


On Jul 18, 2007, at 11:15 PM, Ryan Graciano wrote:

> Fatal error: Exception thrown without a stack frame in Unknown on
> line 0

If you search php.internals you'll find a thread about this.  I can't
remember what the exact error message actually means (Positive it was
discussed though).



[fw-general] ZF changing the cwd

2007-07-18 Thread Ryan Graciano

Sorry for both posts in such a short period of time, but I even though I've
worked around this in my own environment, I thought this post might save
someone else some debug effort.

I'm setting include_path with relative paths in php.ini (and appending to it
in my bootstrap script) and I'm using numerous Zend_* classes all throughout
my code without any trouble, but at one point in my application I hit an
error that indicates Zend_Filter is unable to find Zend_Loader.  This
doesn't make sense because I use Zend_Loader all over the place, including
in my bootstrap script.  After further investigation, it looks like
something is altering my working directory.  I put in an "echo getcwd();" at
the beginning of my app, and another right before I access Zend_Filter (for
the 2nd or 3rd time...), and getcwd()  clearly demonstrates that the working
directory has changed -

IINITIAL CWD: D:\Apache224\htdocs\main
Session open...
Reading session...
GC-ing sessions...
Writing session...
PRE-FILTER CWD: D:\Apache224
*Warning*: Zend_Filter::require_once(Zend/Loader.php) [
function.Zend-Filter-require-once<http://localhost/CK/function.Zend-Filter-require-once>]:
failed to open stream: No such file or directory in *
D:\Apache224\htdocs\CK\library\Zend\Filter.php* on line *88*
*Fatal error*: Zend_Filter::require_once()
[function.require<http://localhost/CK/function.require>]:
Failed opening required 'Zend/Loader.php'
(include_path='.;./application/controllers;./application/models;./application/config;./application/util;./library')



Some random Googling brought me to this page -
http://www.php.net/ob_start
"Some web servers (e.g. Apache) change the working directory of a script
when calling the callback function. You can change it back by e.g.
chdir(dirname($_SERVER['SCRIPT_FILENAME'])) in the callback function."


I'm using Apache, so I did a quick search through the ZF code and I found 12
different occurrences of ob_start.  To narrow it down, I threw echo
statements before each one, and the only one being called is the one in
Zend\Controller\Dispatcher\Standard.php on line 233.  Could this be a
potential defect?  Known issue?  Right now, I'm using absolute paths in my
include_path to work around it.

Thanks,
- Ryan


[fw-general] Error handling with mysqli adapter

2007-07-18 Thread Ryan Graciano

I'm getting the following error message from the mysqli adapter, and I'd
like to know how to gain access to the real error message -

Fatal error: Exception thrown without a stack frame in Unknown on line 0

In this case, the exact offending code was trying to insert an alphanumeric
string into a column with type integer -

$myquery = "INSERT INTO {$this->_name} VALUES ('thisisgoingtobreak')";
$var = $this->getAdapter()->query($myquery);

I simplified this example a great deal to demonstrate the problem, but this
was originally a tough bug to find because I'm not getting a meaningful
error message from the adapter.  Is there a way to get some more verbose
error handling?  I feel like this should have been a very simple bug to
track down if only I was given the error message.

Thanks,
- Ryan


[fw-general] Using the Redirector helper outside of an Action Controller

2007-07-17 Thread Ryan Graciano

I'm trying to implement a little routing in my bootstrap script (before the
dispatcher starts).  Essentially, under very specific conditions, I need to
alter the controller that is invoked.  I found
Zend_Controller_Action_HelperBroker and the Redirector, but I can't seem to
get them to function outside of an Action Controller.  I've tried various
combinations of code similar to this -

$redirector =
Zend_Controller_Action_HelperBroker::getExistingHelper('Redirector');
$redirector->goto('index');

...but nothing seems to work. I've looked through the docs, and all of the
examples seem to function inside of a controller.  Is there an easy way to
accomplish what I'm trying to do?

Thanks,
- Ryan


Re: [fw-general] Re: Zend_Config and YAML using the Syck extension

2007-07-13 Thread Ryan Brooks

Awesome, blogrolled just for that. 

Thanks!

On Fri, 13 Jul 2007 18:12:17 +0300, Shahar Evron <[EMAIL PROTECTED]> wrote:
> How stupid, I forgot the like:
> 
> http://prematureoptimization.org/blog/archives/39
> 
> Shahar ;)
> 
> On Fri, 2007-0



Re: [fw-general] Searching database

2007-07-12 Thread ryan

Hi José,

Have you checked the manual for Zend_Db_Table?

getAdapter()->quoteInto('bug_status = ?', 'NEW');
$order  = 'bug_id';
// Return the 21st through 30th rows
$count  = 10;
$offset = 20;
$rows = $table->fetchAll($where, $order, $count, $offset);
?>

This is outlined further at 
http://framework.zend.com/manual/en/zend.db.table.html

-Ryan

On Thu, 12 Jul 2007 12:54:09 -0300, "José de Menezes Soares Neto" <[EMAIL 
PROTECTED]> wrote:
> everyone forget things :P
> 
> can I limit the numbers of results of a query using fetchAll()?
> 
> 
> 
> 
> 2007/7/11, ViShap <[EMAIL PROTECTED]>:
>>
>> ACK
>>
>> josé, look for tutorials and books to get the basics of php  =)
>>
>> good ressources are google, o´reilleys and of corse ZEND (articles and
>> tutorials)!
>>
>> regards
>>
>> 2007/7/12, till < [EMAIL PROTECTED]>:
>> >
>> > On 7/11/07, ViShap < [EMAIL PROTECTED]> wrote:
>> > > (...)
>> > > 2007/7/11, José de Menezes Soares Neto < [EMAIL PROTECTED]>:
>> > > > (...)
>> >
>> > Guys,
>> >
>> > not to be mean - well forget that! ;-) But maybe a PHP primer is
>> > necessary here and this should be discussed off list?
>> >
>> > Regards,
>> > Till
>> >
>>
>>
> 
> 



Re: [fw-general] Zend Framework Applications Questionnaire

2007-06-15 Thread ryan
This are especially exciting times for the ZF, its users and Zend itself.
I for one cannot wait to hear about what cool things people are doing with
the framework I, for one, have grown rather fond of.

-Ryan

> Hi, I'm relaying this for our marketing team:
>
> Thanks to all the hard work the community has put in we are just about
> ready to release Zend Framework 1.0  As part of this release we will be
> doing significant updates to the website and other outreach.  This
> should help make people aware of the power of Zend Framework and all the
> efforts going on in the community.
>
> To help out with this, we'd like to create a list of Zend Framework
> applications.  If you could please take just 5 minutes to fill out this
> questionnaire, that would be immensely helpful.
>
>   http://www.zoomerang.com/survey.zgi?p=WEB226LT2YCPPA
>
> We hope to feature some of your great work at the framework.zend.com
> site and even if not, would love to hear what you've been up to with ZF.
>
> Thanks,
> Bill Karwin





Re: [fw-general] HTTP Client

2007-06-13 Thread Ryan Boyd

On 6/13/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:


-- Ian Warner <[EMAIL PROTECTED]> wrote
(on Wednesday, 13 June 2007, 11:51 PM +0100):
> Hi
>
> I want to send the following XMl through HTTP Client as a POST
>
>
> $XMLDATA  = '';
> $XMLDATA .= '';
> $XMLDATA .= "";
> $XMLDATA .= "test";
> $XMLDATA .= "test";
> $XMLDATA .= "test";
> $XMLDATA .= "";
> $XMLDATA .= "";
> $XMLDATA .= "";
> $XMLDATA .= "99";
> $XMLDATA .= "12345";
> $XMLDATA .= "" . date('YmdHi') . "";
> $XMLDATA .= "" . $message . "";
> $XMLDATA .= "" . $destination .
"";
> $XMLDATA .= "23433";
> $XMLDATA .= "";
> $XMLDATA .= "";
> $XMLDATA .= "";
>
> $client->setParameterPost(array('XMLDATA' => $XMLDATA));
>
> On the other end I SIMPLE XML this
>
> but I get load of errors due to HTTP client urlencoding and
addingslashes.
>
> If it is urlencoding why does it need to addslashes?
>
> anyway to get round this ?

Send it as a RAW POST:

$clent->setRawData($XMLDATA);

and read the raw post on the server side. This is the typical way XML is
transmitted via HTTP (XML-RPC and SOAP both use it, and it's the
recommended way to POST or PUT data to REST).



Depending on what the server requires, you might also need to set the
Content-Type header to the appropriate value.  For Zend_Gdata, we use
application/atom+xml, but I suspect text/xml would be more appropriate in
your situation.

$client->setHeaders('Content-Type', 'application/atom+xml');

Cheers,
-Ryan

--

Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/



RE: [fw-general] $db->setRowClass & $db->setRowsetClass

2007-03-19 Thread Ryan Brooks
Hi Simon, Art & friends,

Thanks to Art's awesome debugging prowess (I.e. he saw something that I
didn't) it turns out that this entire problem was due to a typo in
Zend_Db_Table_Abstract. The fix follows:

GOTO: Line 582

FIND CODE BLOCK:

$data  = array(
'table'=> $this,
'data' => $this->_fetch('All', $where, $order, $count,
$offset),
'rowclass' => $this->_rowClass
);

REPLACE WITH:

$data  = array(
'table'=> $this,
'data' => $this->_fetch('All', $where, $order, $count,
$offset),
'rowClass' => $this->_rowClass
);

Commit at your leisure.

I have tested this initially and it seems to work for me. I will continue to
advise as I use.

Simon, Art, thanks for your help!

-Ryan

PS: Simon, I'll look into getting some unit tests going.

-Original Message-
From: Art Hundiak [mailto:[EMAIL PROTECTED] 
Sent: March 19, 2007 3:18 PM
To: Ryan Brooks
Cc: 'Simon Mundy'; fw-general@lists.zend.com
Subject: RE: [fw-general] $db->setRowClass & $db->setRowsetClass

In Zend_Db_Table_Abstract::fetchAll() we have
$data  = array(
'table'=> $this,
'data' => $this->_fetch('All', $where, $order, $count,
$offset),
'rowclass' => $this->_rowClass
);
return new $this->_rowsetClass($data);

And in Zend_Db_Table_Rowset_Abstract::__construct() we have:
if (isset($config['rowClass'])) {
$this->_rowClass   = $config['rowClass'];
}

Almost as though the code was released without testing.  Which I guess is
consistent with the fact that there are no DB_Table/Row tests in the
delivered version.

> Hi Simon,
>
>
>
> Yup, setting protected $_rowClass = 'Account'; does work. However, I plan
> on
> lazy loading a lot of my definitions so I can do something like:
>
>
>
> class Accounts extends Custom_Db_Table_Which_Extends_Zend_Db_Table
> implements Custom_Action_Insert_Delete_Authorize
>
> {
>
> public function _setup($config = array())
>
> {
>
> $this->_name = __CLASS__;
>
> $this->setRowClass(
>
> Utility_String_Ucfirst::returnString(
>
>
> Utility_String_Inflector_Singularize::returnString(
>
>
$this->_name)));
>
> parent::_setup($config);
>
> }
>
> }
>
>
>
> Really it's six in one and half a dozen in the other, just a personal
> preference, seeing how far I can push ZF. Unfortunately, this method
> didn't
> work from my initial tests, bringing us to the problem at hand.
>
>
>
> Alas, I do need the custom rowset. I have some methods on the entire
> resultset that I'd like to use in the future. (For instance, pagination
> utilizing view helpers).
>
>
>
> I'd really like if you (or someone) can poke around and see what's going
> wrong, if anything. Otherwise my experience during my upgrade has been
> very
> positive.
>
>
>
> Thanks! Hope to hear from you soon!
>
>
>
> -Ryan
>
>
>
>   _
>
> From: Simon Mundy [mailto:[EMAIL PROTECTED]
> Sent: March 19, 2007 2:35 PM
> To: Ryan Brooks
> Cc: fw-general@lists.zend.com
> Subject: Re: [fw-general] $db->setRowClass & $db->setRowsetClass
>
>
>
> Hi Ryan
>
>
>
> I had a quick look at your table/row definitions.
>
>
>
> This will work:-
>
>
>
> class Accounts extends Zend_Db_Table
>
> {
>
> protected $_name = 'accounts';
>
> protected $_rowClass = 'Account';
>
> }
>
>
>
> You don't need the extra Rowset definition if there's no specific
> functionality you need to add - in most cases the default rowSet class is
> adequate.
>
>
>
> What puzzles me is that your '$this->setRowClass('Account')' _should_ have
> worked. I'll do some digging later to see if anything is awry and post a
> JIRA issue if it turns out to be the case.
>
>
>
> Cheers
>
>
>
> Update:
>
>
>
> Now I know I've missed something.
>
>
>
> In my debugging process, here's what I did.
>
>
>
> Open: Zend/DB/Table/Rowset/Abstract.php
>
> Goto Line: 71
>
> Replace Value of: protected $_rowClass = 'Zend_Db_Table_Row'
>
> With: protected $_rowClass = 'Account'
>
>
>
> Have access to Account->helloWorld();
>
>
>
> I'll keep digging, I seem to be missing a step along the way.
>
>
>
> -Ryan
>
>
>
> PS: Undo changes, save. ;)
>
>
>
>
>
>
>
> --
>
>
>
> Simon Mundy | Director | PEPTOLAB
>
>
>
> """ " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
>
> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
>
> Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
>
> http://www.peptolab.com
>
>
>
>
>
>
>
>






RE: [fw-general] $db->setRowClass & $db->setRowsetClass

2007-03-19 Thread Ryan Brooks
Hi Simon,

 

Yup, setting protected $_rowClass = 'Account'; does work. However, I plan on
lazy loading a lot of my definitions so I can do something like:

 

class Accounts extends Custom_Db_Table_Which_Extends_Zend_Db_Table
implements Custom_Action_Insert_Delete_Authorize

{

public function _setup($config = array())

{

$this->_name = __CLASS__;

$this->setRowClass(

Utility_String_Ucfirst::returnString(

 
Utility_String_Inflector_Singularize::returnString(

$this->_name)));

parent::_setup($config);

}

}

 

Really it's six in one and half a dozen in the other, just a personal
preference, seeing how far I can push ZF. Unfortunately, this method didn't
work from my initial tests, bringing us to the problem at hand.

 

Alas, I do need the custom rowset. I have some methods on the entire
resultset that I'd like to use in the future. (For instance, pagination
utilizing view helpers).

 

I'd really like if you (or someone) can poke around and see what's going
wrong, if anything. Otherwise my experience during my upgrade has been very
positive.

 

Thanks! Hope to hear from you soon!

 

-Ryan

 

  _  

From: Simon Mundy [mailto:[EMAIL PROTECTED] 
Sent: March 19, 2007 2:35 PM
To: Ryan Brooks
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] $db->setRowClass & $db->setRowsetClass

 

Hi Ryan

 

I had a quick look at your table/row definitions.

 

This will work:-

 

class Accounts extends Zend_Db_Table

{

protected $_name = 'accounts';

protected $_rowClass = 'Account';

}

 

You don't need the extra Rowset definition if there's no specific
functionality you need to add - in most cases the default rowSet class is
adequate.

 

What puzzles me is that your '$this->setRowClass('Account')' _should_ have
worked. I'll do some digging later to see if anything is awry and post a
JIRA issue if it turns out to be the case.

 

Cheers



Update:

 

Now I know I've missed something.

 

In my debugging process, here's what I did.

 

Open: Zend/DB/Table/Rowset/Abstract.php

Goto Line: 71

Replace Value of: protected $_rowClass = 'Zend_Db_Table_Row'

With: protected $_rowClass = 'Account'

 

Have access to Account->helloWorld();

 

I'll keep digging, I seem to be missing a step along the way.

 

-Ryan

 

PS: Undo changes, save. ;)





 

--

 

Simon Mundy | Director | PEPTOLAB

 

""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "

202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000

Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124

http://www.peptolab.com





 



RE: [fw-general] $db->setRowClass & $db->setRowsetClass

2007-03-19 Thread Ryan Brooks
Update:

 

Now I know I've missed something.

 

In my debugging process, here's what I did.

 

Open: Zend/DB/Table/Rowset/Abstract.php

Goto Line: 71

Replace Value of: protected $_rowClass = 'Zend_Db_Table_Row'

With: protected $_rowClass = 'Account'

 

Have access to Account->helloWorld();

 

I'll keep digging, I seem to be missing a step along the way.

 

-Ryan

 

PS: Undo changes, save. ;)

 

  _  

From: Ryan Brooks [mailto:[EMAIL PROTECTED] 
Sent: March 19, 2007 1:32 PM
To: fw-general@lists.zend.com
Subject: [fw-general] $db->setRowClass & $db->setRowsetClass

 

Hi guys, this email will be a little long to explain my confusion, please
bear with me.

 

I am trying to create some domain logic in my result objects so I have
access to methods on rowsets and rows. It kinda works, but kinda doesn't.
Unfortunately I think I am either missing something completely, or what I'm
trying to do just isn't possible.

 

I am using the latest nightly build.

 

This all came from wanting to change this: $article =
$db->query($sql)->fetchObject(__CLASS__); 

 

Here's my error:

 

Fatal error: Uncaught exception 'Zend_Db_Table_Row_Exception' with message
'Unrecognized method 'helloWorld()'' in
D:\_php\www\includes\Zend\Db\Table\Row\Abstract.php

 

Well, that's obvious - I'm trying to access a non-existent method.

 

However, here's some code. I hope that you'll be able to understand at a
glance what I'm trying to do. I have stripped out most of my un-needed code.
I can verify that the database has connected, and the view object does
exist.

 

class AccountsController extends BootstrapController

{

public function indexAction()

  {

$accounts = new Accounts();

$this->view->accounts = $accounts->fetchAll();

 

Zend_Debug::dump($this->view->accounts); // debug

 

foreach($this->view->accounts as $account)

{

  echo $account->helloWorld(); // This is the cause of our
problem

}

  }

}

class Accounts extends Zend_Db_Table

{

  public function _setup($config = array())

  {

$this->_name = 'accounts';

$this->setRowClass('Account'); // this seems to be ignored

$this->setRowsetClass('AccountsRowset');

parent::_setup($config);

  }

}

class AccountsRowset extends Zend_Db_Table_Rowset

{

  public function _setup($config = array())

  {

$this->_name = 'accounts';

$this->setRowClass('Account'); // this seems to be ignored

parent::_setup($config);

  }

}

class Account extends Zend_Db_Table_Row

{

  public function _setup($config = array())

  {

$this->_name = 'accounts';

parent::_setup($config);

  }

  public function helloWorld()

  {

return 'hello ' . $this->name;

  }

}

 

Now. When I look at the dump(), I can see the data. The row class and rowset
class is being set. However, it is still calling Zend_Db_Table_Row. To aid
in debugging, here is my dump.

 

object(AccountsRowset)#20 (8) {
  ["_data:protected"] => array(2) {
[0] => array(7) {
  ["id"] => string(1) "1"
  ["date_entered"] => string(19) "2007-03-17 21:24:38"
  ["date_modified"] => NULL
  ["created_by"] => string(1) "1"
  ["assigned_user_id"] => NULL
  ["name"] => string(1) "d"
  ["deleted"] => NULL
}
[1] => array(7) {
  ["id"] => string(1) "2"
  ["date_entered"] => string(19) "2007-03-19 11:45:17"
  ["date_modified"] => NULL
  ["created_by"] => string(1) "1"
  ["assigned_user_id"] => NULL
  ["name"] => string(4) ""
  ["deleted"] => NULL
}
  }
  ["_table:protected"] => object(Accounts)#19 (8) {
["_db:protected"] => object(Zend_Db_Adapter_Pdo_Mysql)#12 (5) {
  ["_pdoType:protected"] => string(5) "mysql"
  ["_config:protected"] => array(6) {
["dbtype"] => string(9) "pdo_mysql"
["host"] => string(9) "localhost"
["username"] => string(4) "root"
["password"] => string(0) ""
["dbname"] => string(3) "crm"
["debugEnabled"] => string(4) "true"
  }
  ["_fetchMode:protected"] => int(2)
  ["_prof

[fw-general] $db->setRowClass & $db->setRowsetClass

2007-03-19 Thread Ryan Brooks
Hi guys, this email will be a little long to explain my confusion, please
bear with me.

 

I am trying to create some domain logic in my result objects so I have
access to methods on rowsets and rows. It kinda works, but kinda doesn't.
Unfortunately I think I am either missing something completely, or what I'm
trying to do just isn't possible.

 

I am using the latest nightly build.

 

This all came from wanting to change this: $article =
$db->query($sql)->fetchObject(__CLASS__); 

 

Here's my error:

 

Fatal error: Uncaught exception 'Zend_Db_Table_Row_Exception' with message
'Unrecognized method 'helloWorld()'' in
D:\_php\www\includes\Zend\Db\Table\Row\Abstract.php

 

Well, that's obvious - I'm trying to access a non-existent method.

 

However, here's some code. I hope that you'll be able to understand at a
glance what I'm trying to do. I have stripped out most of my un-needed code.
I can verify that the database has connected, and the view object does
exist.

 

class AccountsController extends BootstrapController

{

public function indexAction()

  {

$accounts = new Accounts();

$this->view->accounts = $accounts->fetchAll();

 

Zend_Debug::dump($this->view->accounts); // debug

 

foreach($this->view->accounts as $account)

{

  echo $account->helloWorld(); // This is the cause of our
problem

}

  }

}

class Accounts extends Zend_Db_Table

{

  public function _setup($config = array())

  {

$this->_name = 'accounts';

$this->setRowClass('Account'); // this seems to be ignored

$this->setRowsetClass('AccountsRowset');

parent::_setup($config);

  }

}

class AccountsRowset extends Zend_Db_Table_Rowset

{

  public function _setup($config = array())

  {

$this->_name = 'accounts';

$this->setRowClass('Account'); // this seems to be ignored

parent::_setup($config);

  }

}

class Account extends Zend_Db_Table_Row

{

  public function _setup($config = array())

  {

$this->_name = 'accounts';

parent::_setup($config);

  }

  public function helloWorld()

  {

return 'hello ' . $this->name;

  }

}

 

Now. When I look at the dump(), I can see the data. The row class and rowset
class is being set. However, it is still calling Zend_Db_Table_Row. To aid
in debugging, here is my dump.

 

object(AccountsRowset)#20 (8) {
  ["_data:protected"] => array(2) {
[0] => array(7) {
  ["id"] => string(1) "1"
  ["date_entered"] => string(19) "2007-03-17 21:24:38"
  ["date_modified"] => NULL
  ["created_by"] => string(1) "1"
  ["assigned_user_id"] => NULL
  ["name"] => string(1) "d"
  ["deleted"] => NULL
}
[1] => array(7) {
  ["id"] => string(1) "2"
  ["date_entered"] => string(19) "2007-03-19 11:45:17"
  ["date_modified"] => NULL
  ["created_by"] => string(1) "1"
  ["assigned_user_id"] => NULL
  ["name"] => string(4) ""
  ["deleted"] => NULL
}
  }
  ["_table:protected"] => object(Accounts)#19 (8) {
["_db:protected"] => object(Zend_Db_Adapter_Pdo_Mysql)#12 (5) {
  ["_pdoType:protected"] => string(5) "mysql"
  ["_config:protected"] => array(6) {
["dbtype"] => string(9) "pdo_mysql"
["host"] => string(9) "localhost"
["username"] => string(4) "root"
["password"] => string(0) ""
["dbname"] => string(3) "crm"
["debugEnabled"] => string(4) "true"
  }
  ["_fetchMode:protected"] => int(2)
  ["_profiler:protected"] => object(Zend_Db_Profiler)#14 (4) {
["_queryProfiles:protected"] => array(0) {
}
["_enabled:protected"] => bool(false)
["_filterElapsedSecs:protected"] => NULL
["_filterTypes:protected"] => NULL
  }
  ["_connection:protected"] => object(PDO)#17 (0) {
  }
}
["_name:protected"] => string(8) "Accounts"
["_cols:protected"] => array(7) {
  [0] => string(2) "id"
  [1] => string(12) "date_entered"
  [2] => string(13) "date_modified"
  [3] => string(10) "created_by"
  [4] => string(16) "assigned_user_id"
  [5] => string(4) "name"
  [6] => string(7) "deleted"
}
["_primary:protected"] => string(2) "id"
["_rowClass:protected"] => string(7) "Account"
["_rowsetClass:protected"] => string(14) "AccountsRowset"
["_referenceMap:protected"] => array(0) {
}
["_dependentTables:protected"] => array(0) {
}
  }
  ["_connected:protected"] => bool(true)
  ["_tableClass:protected"] => string(8) "Accounts"
  ["_rowClass:protected"] => string(17) "Zend_Db_Table_Row"
  ["_pointer:protected"] => int(0)
  ["_count:protected"] => int(2)
  ["_rows:protected"] => array(0) {
  }
}
 
I'm hoping someone can help me out. I'm kinda at a loss.
 
-Ryan


RE: [fw-general] Great work with 0.9

2007-03-19 Thread Ryan Brooks
I second this statement. I've been working with ZF since 0.2 and I grow
increasingly impressed with it! 0.9 is, obviously, the best release EVAH!


-Original Message-
From: Teemu Välimäki [mailto:[EMAIL PROTECTED] 
Sent: March 19, 2007 12:55 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Great work with 0.9

Thank you so much!

What can I say, I'm developing several big applications which ZF and even
with the API changes from 0.8 took a while to fix I applaud for them. Sure
there are bugs and inconsistencies both in manual and the framework itself
but it does not make it unusable. I understand that people want to be on the
bleeding edge and so on but lets give the developers a break with a cookie
or two.

Just think about where you would be without ZF. Maybe writing filter for
user input? Maybe some SQL? Maybe implementing your version of ACL and Auth?
Yes, it can be fruitful to do those for personal experience but in a
business world that's simply a no-no.

Let's all take a break with a cookie :)




RE: [fw-general] Zend_Db_Table_Row __get()

2007-03-19 Thread Ryan Brooks
"Doesn't seem to make much sense as an element of consistency has been lost
here."

Hmm. Good point.

-Original Message-
From: Jon [mailto:[EMAIL PROTECTED] 
Sent: March 19, 2007 10:53 AM
To: fw-general@lists.zend.com
Subject: RE: [fw-general] Zend_Db_Table_Row __get()

I don't understand why the camel case conversion has been dropped? 

As far as I can see all variables (in ZF) are camelCased, even the PDF
document "Best Practices of PHP Development" written by Zend states that all
variables should be camelCased. So why change it for Zend_Db? Doesn't seem
to make much sense as an element of consistency has been lost here.

-Original Message-
From: Art Hundiak [mailto:[EMAIL PROTECTED] 
Sent: 19 March 2007 16:42
To: fw-general@lists.zend.com
Subject: RE: [fw-general] Zend_Db_Table_Row __get()

Basic problem is that the pdo adapter has:
// force names to lower case
$this->_connection->setAttribute(PDO::ATTR_CASE,
PDO::CASE_LOWER);

You will have to figure out how to change it to CASE_NATURAL.  Even then I
suspect you might have trouble with case sensitivity.

I myself rather liked the camel case conversion.  It being dropped is one
of the reasons I gave up on Zend_Db.

>
> It appears that all column preparation has been removed on each row.
>
> 0.8 Usage:
>
> CREATE TABLE `accounts` (
>   `id` int(11) NOT NULL auto_increment,
>   `date_entered` datetime default NULL,
>   `date_modified` datetime default NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB;
>
> foreach($this->account as $account)
> {
>   echo $account->dateModified;
> }
>
> Current 0.9 Usage: (untested)
>
> foreach($this->account as $account)
> {
>   echo $account->date_modified;
> }
>
> I never liked the camel-casing. I found it confusing. I like the 0.9 usage
> better because I know exactly what to expect. The camel-casing limited
> system predictability. (This can of course be argued both ways).
>
> Bug? Feature?
>
> -Original Message-
> From: Aaron Egaas [mailto:[EMAIL PROTECTED]
> Sent: March 19, 2007 10:26 AM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Zend_Db_Table_Row __get()
>
>
> Hello,
>
> Prior to 0.9, I was using underscored field names in my MySQL database and
> relying on Zend_Db's inflector to produce nice Camel-cased field names
> within the Zend framework. Since 0.9 with the inflector gone, I switched
> my
> field name in the database to camel case so I didn't have to refactor a
> lot
> of code. Unforunately I think I found a bug when I did this.
>
> All over my app I get exceptions saying the field (jobId for example)
> isn't
> found! I dumped out the Db_Row and all the fieldnames have been lower
> cased.
>
> I'm using MySQL's PDO. Anyone know whats causing my plight?
>
> -Aaron Egaas
>
>
> --
> View this message in context:
>
http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95
> 55537
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>
>
>






RE: [fw-general] Zend_Db_Table_Row __get()

2007-03-19 Thread Ryan Brooks
It appears that all column preparation has been removed on each row.

0.8 Usage:

CREATE TABLE `accounts` (
  `id` int(11) NOT NULL auto_increment,
  `date_entered` datetime default NULL,
  `date_modified` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB;

foreach($this->account as $account)
{
echo $account->dateModified;
}

Current 0.9 Usage: (untested)

foreach($this->account as $account)
{
echo $account->date_modified;
}

I never liked the camel-casing. I found it confusing. I like the 0.9 usage
better because I know exactly what to expect. The camel-casing limited
system predictability. (This can of course be argued both ways).

Bug? Feature?

-Original Message-
From: Aaron Egaas [mailto:[EMAIL PROTECTED] 
Sent: March 19, 2007 10:26 AM
To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Db_Table_Row __get()


Hello,

Prior to 0.9, I was using underscored field names in my MySQL database and
relying on Zend_Db's inflector to produce nice Camel-cased field names
within the Zend framework. Since 0.9 with the inflector gone, I switched my
field name in the database to camel case so I didn't have to refactor a lot
of code. Unforunately I think I found a bug when I did this.

All over my app I get exceptions saying the field (jobId for example) isn't
found! I dumped out the Db_Row and all the fieldnames have been lower cased.

I'm using MySQL's PDO. Anyone know whats causing my plight?

-Aaron Egaas


-- 
View this message in context:
http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95
55537
Sent from the Zend Framework mailing list archive at Nabble.com.





Re: [fw-general] PHP Adoption and the Zend Framework

2006-12-12 Thread Ryan Lange

Paul Court wrote:


I am 99% sure the default ubuntu (6.10) server comes with PHP 5 (If you 
choose the LAMP option). I don't remember doing any other webstuff and 
my server signature is thus...


Apache/2.0.55 (Ubuntu) PHP/5.1.6 mod_ssl/2.0.55 OpenSSL/0.9.8b Server at 
mail2 Port 443


(Sorry, Paul. Meant to send this to the list, not you directly. ;-) )

Off-topic question...

I have a VM with Ubuntu 6.06 LTS installed, and the default is PHP 
5.1.2. Unfortunately, for some unknown reason, Canonical decided not to 
compile in the PDO extension. Have they fixed this oversight in 6.10?


Thanks,
Ryan


Re: [fw-general] ZFApp project renamed to Primitus

2006-09-22 Thread Mark Ryan
Sounds like some sort of Medical condition
 
How does some abstract Brand name give clarity to something as clear as  ZFApp? 
On 9/22/06, Stefan Koopmanschap <[EMAIL PROTECTED]> wrote:
Nice. Clarity is good, and I love the name :)
On 9/21/06, John Coggeshall <[EMAIL PROTECTED]> wrote:
 
For the sake of clarity, the ZFApp project has been renamed to Primitus.Those who have already subscribed to the ZFApp mailing list have already
been automatically subscribed to the new mailing list. I'll have Urls shortly for you regarding the tracker, etc.Cheers,John-- Stefan Koopmanschap
http://www.stefankoopmanschap.nl/ 
http://www.leftontheweb.com/