Within my  Employee Manager Component, I have the folowing function .

function get_manager( $department ){
$this -> controller -> loadModel( "Account" );
$this -> controller -> Account -> useDbConfig = $this -> controller ->
db_name;
$sql = "SELECT * FROM accounts Account LEFT JOIN account_roles
AccountRole ON Account.id = AccountRole.accounts_id LEFT JOIN
employees Employee on Account.id = Employee.accounts_id WHERE
AccountRole.departments_id = " . $department . " AND
AccountRole.roles_id in ( 7, 6, 4 )";

return $this -> controller -> Account -> Query( $sql );
}

how can I call this from the shell script? I am getting the following
error and can't get it work.


Fatal error: ConnectionManager::getDataSource - Non-existent data
source  in
/cake/libs/model/connection_manager.php on line 109
[~]#  ConnectionManager::getDataSource - Non-existent data source


In the shell I call the component like this

$this -> controller = new AppController();
$this -> controller -> components = $this-> components;
$this -> empManager = new EmployeeManagerComponent(null);
$this -> empManager -> startup( $this -> controller );

$manager_obj = $this -> empManager -> get_manager( $department_id );

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to