Forum

Accessing the objec...
 
Notifications
Clear all

Accessing the objects which are made of classes

2 Posts
2 Users
0 Reactions
2,335 Views
koorosh
(@keloniton)
Posts: 47
Active Member
Topic starter
 
[#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


 
Posted : 07 Apr 2016 17H47
(@babynus)
Posts: 14952
Member Admin
 

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


 
Posted : 09 Apr 2016 0H41
Share:

Scroll to Top