Saturday, November 27, 2010

Re: Fatal error: Call to a member function entity() on a non-object in /var/www/cake/1.3/cake/libs/view/helper.php on line 567

O, I have it:

class TextHelper extends AppHelper {
var $helpers = array('Html', 'Form');

and it works, both $this->Html and $this->Form. But when I try to
test, and test only, then the Form helper inside TextHelper, but not
Html helper, triggers the error, and only while testing. Perhaps a bug
with cake.

So then I did this in my helper:

function __construct() {
App::import('Helper', 'Html');
$this->Html = new HtmlHelper();

App::import('Helper', 'Form');
$this->Form = new FormHelper();
}

And it still doesn't work. The Html works and Form doesn't.

I don't want to debug my debugging code more than the time I spend
writing the actual code...

\V


On Nov 26, 2:55 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> u need to use *var $helpers = array("list", "of", "helpers");* in helper
> class which helpers will helper use :D
>
> i think this is problem...
> --
> Tilen Majerlehttp://majerle.eu
>
> 2010/11/26 piousbox <pious...@gmail.com>
>
> > I get this while testing. Here's my test code:
>
> > function testLogin_register() {
> >            $actual = $this->Text->login_register();
> >        }
>
> > and the helper code that's being tested:
>
> > function login_register($user = false) {
> > // ...
> >        $out = '';
> >            $out .= $this->Form->create('User', array('url' =>
> > array('controller' => 'users', 'action' => 'login')));
> >            $out .= $this->Form->input('User.username', array('label'
> > => false));
> >            $out .= $this->Form->input('User.password', array('label'
> > => false));
> >            $out .= $this->Form->end('Login');
> > // ...
> >        return $out;
> >    }
>
> > So basically that I use $this->Form inside my helper results in an
> > error (but using $this->Html doesn't). Does anyone have an idea why
> > so?
>
> > \V
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: