Forum

Accessing the objec...
 
Notifications
Retirer tout

Accessing the objects which are made of classes

2 Posts
2 Utilisateurs
0 Reactions
2,334 Vu
koorosh
(@keloniton)
Posts: 47
Active Member
Début du sujet
 
[#3247]

Hello Dear Mr Babynus,
i am trying to access the the month field of Expense object which is made of model/Expense.php. In order to do this, in tool/saveobject i add the following code. But it does not work. Can you help me to understand the problem:

if ($className == "Expense") { //first i check whether the class is Expesne or not
$equilgregoriandate= gregorian_to_jalali( substr($newObj->day,0,4) , substr($newObj->day,4,2) , substr($newObj->day,6,2)); //I get the jalali date of the day field
if ($equilgregoriandate[1]<10) { //i check if the date is in correct format
$equilgregoriandate[1]='0'.$equilgregoriandate[1];
}
if ($equilgregoriandate[2]month = jdate('Ym',jmktime(0,0,0,$equilgregoriandate[1],$equilgregoriandate[2],$equilgregoriandate[0]),'','','en'); //i replace the month field with another string;
}
There is no error, but it does not work when i check the Expense table in Phpadmin.
Thank you


 
Posté : 7 Avr PM 17:044
(@babynus)
Posts: 14952
Membre Admin
 

The implementation in the saveObject in not good.
You should instead implement your code in the save() functin of the Expense object.


 
Posté : 9 Avr AM 00:044
Share:
Retour en haut