Undefined function in My Task

Discussion specific to symfony 1.1.x stable

Moderator: hartym

Undefined function in My Task

Postby DDprog » Mon Aug 11, 2008 4:24 pm

Hello,

I have created a task and i would like call a function under the execute function.

When i launch my task, i have an error :

Call to undefined function LogMess() in MyTaskTask.class.php on line ....

My script is below :

<pre>
class MyTaskTask extends sfBaseTask
{
protected function configure()
{
$this->namespace = 'Frontend';
$this->name = 'MyTask';
$this->briefDescription = 'bla bla';
$this->detailedDescription = <<<EOF
Task [SynchroID2|INFO]
Call with

[php symfony SynchroID2|INFO]
EOF;
}

function LogMess($FileLog,$typeMess,$Mess)
{
$result = fwrite($FileLog,date("Y-m-d H-i-s" ;).$typeMess.$Mess);
return $result;
}

protected function execute($arguments = array(), $options = array())
{
//create a log file
$fileLogP = fopen('LogFILE.LOG',"a" ;);
// write in log file
LogMess($fileLogP ,'I',"bla bla " ;);
{

</pre>

thank you very much
;)~ ;-)~ :wink:
DDprog
Junior Member
 
Posts: 2
Joined: Mon Aug 11, 2008 10:34 am

Re: Undefined function in My Task

Postby rsevero » Mon Aug 11, 2008 4:45 pm

DDprog wrote: Call to undefined function LogMess() in MyTaskTask.class.php on line ....
<pre>
protected function execute($arguments = array(), $options = array())
{
//create a log file
$fileLogP = fopen('LogFILE.LOG',"a");
// write in log file
LogMess($fileLogP ,'I',"bla bla ");
{
</pre>

I believe you are having basic PHP OOP dificulties.

You should call
Code: Select all
$this->LogMess($fileLogP ,'I',"bla bla ");
and not
Code: Select all
LogMess($fileLogP ,'I',"bla bla ");
As I said, this is basic PHP OOP, there isn't anything specific to symfony here.


Regards,

Rodrigo Severo
rsevero
Junior Member
 
Posts: 18
Joined: Fri Jul 11, 2008 4:29 pm

SOLVED : Undefined function in My Task

Postby DDprog » Mon Aug 11, 2008 5:02 pm

You'r right
It's a basic PHP OOP.

sorry to my bad post and thank you very much.
Last edited by DDprog on Tue Aug 12, 2008 8:53 am, edited 1 time in total.
DDprog
Junior Member
 
Posts: 2
Joined: Mon Aug 11, 2008 10:34 am


Return to symfony 1.1

Who is online

Users browsing this forum: No registered users and 2 guests