Re: [fw-general] Possible bug in Zend_Test_PHPUnit??

2009-07-13 Thread joedevon

MATTHEW:No, actually. When you set it as you did in preDispatch(), there is
no
check until postDispatch() to see if a redirect occurred. This should
likely be changed; care to file an issue in the tracker?

ME: I had a similar problem, setting a redirect in the preDispatch() w/ the
same code you used in your login tutorial. I thought I'd get around the
issues by moving the code to a private method:

private function _redirectLoggedInUsers()
{
//redirect the following actions to the homepage
if(Zend_Auth::getInstance()-hasIdentity()) {
switch($this-getRequest()-getActionName()) {
case 'index':
case 'login':
case 'forgot':
return $this-_helper-redirector('index', 
'index');
}
};
}

and then call that method from the ('index','login','forgot') controllers
respectively. But it behaves the same way as in preDispatch(). Zend_Test
ignores the redirect although it works fine in actual use.
-- 
View this message in context: 
http://www.nabble.com/Possible-bug-in-Zend_Test_PHPUnit---tp21535557p24467170.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Re: re[fw-general] gistering action helper in zf1.8

2009-06-16 Thread joedevon


jigen7 wrote:
 
 I really need help in creating my custom action helper i dont know where
 to start ,where to put the files, how to register it via application.ini
 if i put it to a custom folder as of zf 1.8 so i can call it directly to
 my controllers.
 

In your Bootstrap.php put this:

protected function _initActionHelpers()
{
   
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH./controllers/helpers);
}

And your action helpers go in /application/controllers/helpers
-- 
View this message in context: 
http://www.nabble.com/registering-action-helper-in-zf1.8-tp24049492p24062606.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Of 3 methods to centralize code used in all/many controllers which do you use when?

2009-06-15 Thread joedevon

The following question on Stack Overflow prompted this post:

http://stackoverflow.com/questions/866367/how-do-i-centralize-code-from-my-init-functions-in-all-controllers/866517

How do I centralize code from my init functions in all controllers?

Three answers all work I believe:

1. Extend Zend_Controller_Action and have your controllers extend from THERE

2. Write a plugin by extending Zend_Controller_Plugin_Abstract

3. Create an Action Helper

I assume there are situations where each one of those is the best solution.
I've been doing answer 1 mostly, but thinking about switching to answer 3
for future projects. 

But I'd like to know what the recommended situations are for each solution.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Of-3-methods-to-centralize-code-used-in-all-many-controllers-which-do-you-use-when--tp24047991p24047991.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Application and autoloading

2009-06-11 Thread joedevon

I set up my Bootstrap without a namespace either and added this to
application.ini to get my modules to show:

resources.frontController.moduleDirectory = APPLICATION_PATH /modules

-- 
View this message in context: 
http://www.nabble.com/Zend_Application-and-autoloading-tp23987637p23989250.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Application and autoloading

2009-06-11 Thread joedevon

What's yr error message?

I assume you have a dir structure like:

/application
/application/modules
/application/modules/mymodule
/application/modules/mymodule/controllers
./models
/views

etc?
-- 
View this message in context: 
http://www.nabble.com/Zend_Application-and-autoloading-tp23987637p23989431.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Application and autoloading

2009-06-11 Thread joedevon


spaceage wrote:
 
 Its the default structure as setup by Zend_Tool:
 
 /application
 bootstrap.php
 /configs
 /controllers
 /layouts
 /models
 /views
 /library
 /public
 index.php 
 
You don't have a modules directory under application. And I get the feeling
you don't need a module...you're just trying to get the model to autoload,
right?



 realpath(APPLICATION_PATH . '/models'), 
 
You don't need to include models there. Once it knows the path to
application, it will figure out the path to models. 

What is your include path (from the error message)?
Did you set up APPLICATION_ENV (which is slightly different wording than
before ZF 1.8)?


 Without a require_once for my class files in /application/models, I get a
 Fatal Error, class not found...
 

Where are you putting the require_once in order to get it to work?
How are you calling the Model?

Make sure that you name the class in the model like so
Model_MyName

NOT Default_Model_MyName as in the quickstart since you don't have Default
in the Bootstrap...

Sorry, it can be so many things, so I'm throwing out ideas.
-- 
View this message in context: 
http://www.nabble.com/Zend_Application-and-autoloading-tp23987637p23989778.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Application and autoloading

2009-06-11 Thread joedevon


spaceage wrote:
 
 My include path is (1) the library dir where ZF is located, (2) the
 /application/models dir and (3) .
 
You don't need /application/models in the path. Remove the line that sets
it. It's just adding an extra path to slow down the system a bit.



 I'm a little unclear when you say once it knows path to application it
 will figure out path to models: wouldn't this also be the case if instead
 of using /application as an include_path, I would use /application/models
 and get same result for classes in the models dir?
 
In /public/index.php, this line defines APPLICATION_PATH:

defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) .
'/../application'));

that's all it needs to know.


Right now this is working:
 
 require_once '../application/models/LoginForm.php';
 
Remove the require line


$login = new LoginForm();
change to $login = new Model_LoginForm
and make sure in /application/models/LoginForm.php' the class is defined
thusly:
class Model_LoginForm

and hopefully you should be all set.

-- 
View this message in context: 
http://www.nabble.com/Zend_Application-and-autoloading-tp23987637p23990600.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Application and autoloading

2009-06-11 Thread joedevon


spaceage wrote:
 
 class Model_LoginForm extends Zend_Form
 

Oops, yeah you're using Zend_Form. that goes here:
/application/forms

and the file should be named Login.php and begins 

class Form_Login extends Zend_Form

I haven't used Zend_Form yet, been doing forms manually but will try it
soon. I still think the above is correct though.


 
 I think I like this whole Zend_Application thing ???
 
 

Actually this wasn't caused by Zend_Application... 

I think the docs need some more work...but I didn't realize how few people
are doing this full time. It's amazing what Matthew and their small team
have achieved considering it's what, 3 full timers and then community
volunteers? I'm really impressed.

But don't get frustrated. It'll be second nature soon :)
-- 
View this message in context: 
http://www.nabble.com/Zend_Application-and-autoloading-tp23987637p23990877.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Application and autoloading

2009-06-11 Thread joedevon


spaceage wrote:
 
 I should add that 'model' and 'models' were being used interchangeably in
 both of our posts, and I've updated everything to be 'models'/'Models'
 throughout...
 
I don't know how I missed this post...I wasn't using model and models
interchangeably...You need to remove plural from new Models_Login to
Model_Login and also no plural in the class

Taking from Rob's excellent tutorial:

The module autoloader will autoload classes with a certain prefix that are
in
certain directories within application/ as per this table:

Directory|Prefix|  Example
=
api |  Api_ | Api_Rest
forms | Form_   |   Form_Login
models   | Model_  |  Model_News
models/DbTable  |  Model_DbTable_ |   Model_DbTable_News
plugins   |  Plugin_ |Plugin_

Hope that table comes out ok...so according to this, the autoloader looks in
the file and reads the class name, so putting zend form in the models
directory is messing you up unless I read Rob incorrectly
-- 
View this message in context: 
http://www.nabble.com/Zend_Application-and-autoloading-tp23987637p23991358.html
Sent from the Zend Framework mailing list archive at Nabble.com.