I have a table called 'employee' which contains an attribute 'mgr_id' manager is also an employee
I want to add an employee to some manager.
I have define in Employee class like
class Employee extends Acti....{
var $belongs_to = array('employee'); var $has_many = array('employees');
}
when trying to make some operation like listing employees for such manager I got this error page:
Notice: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1 in C:\xampp\htdocs\akelos\lib\AkActiveRecord.php on line 1194
Tasks:
Fatal error: Call to a member function getId() on a non-object in C:\xampp\projects\hr\app\views\employee\compiled\show.tpl.php on line 4
Look at http://wiki.akelos.org/display-acts-as-tree-recursively?s=parent
What about setting a different foreign key (besides the primary id)?
Here's my short create table statement with comments
$this->createTable('customers',
'id,'. // Primary KEY
'ListID,'. // ListID from QB
'Name,'. // Name from QB
'FullName,'. // Full Name "Joe Smith" or "Joe Smith:Remodel" from QB
'ParentRefListID,'. // ListID of parent. (also from QB)
);
Currently I have the following inside my model (customer.php)
var $acts_as = array('tree' =>
array('parent_column' => 'ParentRefListID'));
Any ideas?
Hmm, according to AkActsAsTree.php, it' wouldn't be possible without a little bit of modification. 'ActiveRecordInstance->getId()' is hardcoded. See rows 263 and 268.
return $this->_ActiveRecordInstance->isNewRecord() ? false : $this->_ActiveRecordInstance->findAll(" ".$this->getScopeCondition()." AND ".$this->getParentColumnName()." = ".$this->_ActiveRecordInstance->getId());
Perhaps this could be stuck on the wishlist then. For now I'll use the ListID as the primary key.
1 to 4 of 4