I am using HMVC codeigniter 3. I have a folder called admin under and in that folder I have a subfolder called client. In my config file, i have set up the module path like this;
$config['modules_locations'] = array(
APPPATH.'modules/' => '../modules/',
APPPATH.'modules/admin/' => '../modules/admin/',
);
Now, the problem is, its loadig my client controller but its not loading my entites. it is showing me the following error;
> An uncaught Exception was encountered
>
> Type: Doctrine\ORM\Query\QueryException
>
> Message: [Semantical Error] line 0, col 109 near 'entities\AppClient':
> Error: Class 'entities\AppClient' is not defined.
Please help me to solve this issue..This client module works fine, if i moved it from sub module to only modules folder
solved it...Add the following function in doctorine.php
private function _recursiveDir(&$array, $directory)
{
$scanned_dir = array_diff(scandir($directory), array('..', '.'));
sort($scanned_dir);
$subModules = array(
"admin"
);
foreach ($scanned_dir as $module) {
if (is_dir($directory.$module."/models")) {
$array[] = $directory.$module."/models/doctrine/entities";
} else if (in_array($module, $subModules)) {
$this->_recursiveDir($array, $directory.$module."/");
}
}
}
Related
I have a Laravel application working on different urls. example.ch and app.example.net are working will. On the same server like app.example.net i like to run app-stage.example.net.
The application return an error 500 without an error log.
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
var_dump($kernel); // returns an object. Everything ok
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
var_dump($response) //returns error 500
I checked the php version.
I checked the fpm version.
I checked the .env file
I did "sudo chmod -R 777 bootstrap/cache storage"
I restarted the server.
I tried to show the errors.
error_reporting(-1); // reports all errors
ini_set("display_errors", "1"); // shows all errors
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/php-error.log");
No success.
What can I do in addition to find the error?
use this package Dotenv
make a file like this
and then use multiple .env for example acceptnace.env . production.env , staging.env
make a file like environment.php in bootstrap directory like this
<?php
$envPath = realpath(dirname(__DIR__));
$env = get_current_user();
if ($env == 'staging') {
$envFile = ".staging.env";
} elseif ($env == "acceptance") {
$envFile = ".acceptance.env";
} elseif ($env == "development") {
$envFile = ".development.env";
} elseif ($env == "production") {
$envFile = ".production.env";
} elseif ($env == "beta") {
$envFile = ".beta.env";
} else {
$envFile = ".local.env";
}
Dotenv\Dotenv::create($envPath, $envFile)->load();
and this will load multiple env for your app
When I try to run my page in Wakanda studio 1.1.3, I am getting an error during the compiling when converting the TS to JS. It shows me an error stating "cannot find the datastore"; which is present in my wakanda database. Is anyone else getting the same error?
here is the code:
this.wakanda.catalog.then(ds=>{
ds.TestDatabase.testmethod().then(op=>{
console.log(op);
});
});
my wakanda.service.ts is of the following
import {WakandaClient} from 'wakanda-client/browser/no-promise';
export class Wakanda {
private _client: WakandaClient;
private _catalog;
constructor() {
//this._client = new WakandaClient({ host: 'http://127.0.0.1:8081' });
this._client = new WakandaClient({});
this._catalog = null;
}
get catalog() {
if (!this._catalog) {
return this._client.getCatalog().then(c => {
this._catalog = c;
return c;
});
}
return Promise.resolve(this._catalog);
}
get directory() {
return this._client.directory;
}
get wakandaClientVersion() {
return this._client.version();
}
}
where TestDatavase is a table in my datastore and has a method called testmethod.
[default]
/Users/adithyavinayak/Documents/Wakanda/solutions/TestDatabase/TestDatabase/web/src/app/home/home.component.ts:21:8
Property 'TestDatabase' does not exist on type 'Catalog'. [default]
Checking finished with 4 errors
This one happens even if i make a call to any datastore during compile time.
The solution for this problem is by using the return type of the catalog to any
this.wakanda.catalog.then((ds:any)=>{
ds.TestDatabase.testmethod().then(op=>{
console.log(op);
});
});
This one works without any problem during the time of compilation.
Below is the function to receive all incoming calls in my Controller
public function call_incoming()
{
$blocklist = $this->call_log_model->get_blocklist($_REQUEST['From']);
$tenantNum = $this->call_log_model->get_called_tenant($_REQUEST['From']);
$tenantInfoByNumber = $this->account_model->getTenantInfoByNumber($tenantNum->to_tenant);
$officeStatus = $this->check_office_hours($tenantInfoByNumber->start_office_hours, $tenantInfoByNumber->end_office_hours);
$calldisposition = $this->calldisp_model->get_call_disposition($tenantInfoByNumber->user_id);
$response = new Services_Twilio_Twiml;
if($blocklist == 0)
{
if($officeStatus == "open")
{
if($_POST['Called'] != AGENTPOOL_NUM)
{
$data = array(
'caller'=>$_REQUEST['From'],
'to_tenant'=>$_POST['Called'],
'date_created'=>date('Y-m-d H:i:s')
);
$this->call_log_model->insert_caller_to_tenant($data);
$dial = $response->dial(NULL, array('callerId' => $_REQUEST['From']));
$dial->number(AGENTPOOL_NUM);
print $response;
}
else
{
$gather = $response->gather(array('numDigits' => 1, 'action'=>HTTP_BASE_URL.'agent/call_controls/call_incoming_pressed', 'timeout'=>'5' , 'method'=>'POST'));
$ctr = 1;
foreach($calldisposition as $val )
{
$gather->say('To go to '.$val->disposition_name.', press '.$ctr, array('voice' => 'alice'));
$gather->pause("");
$ctr++;
}
print $response;
}
}
else
{
$response->say('Thank you for calling. Please be advise that our office hours is from '.$tenantInfoByNumber->start_office_hours.' to '.$tenantInfoByNumber->end_office_hours);
$response->hangup();
print $response;
}
}
else
{
$response->say('This number is blocked. Goodbye!');
$response->hangup();
print $response;
}
}
Please advise if I need to post the model...
Here is whats happening everytime an unknown number calls in, the caller will hear an application error has occurred error message and when checking the Twilio console the error it is giving me is
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: agent/Call_controls.php
Line Number: 357
Please be advised that this error only occurs when the caller is a number not in our database yet. When the call comes from a number already saved in our databse, this codes works...
Thank you for the help...
if($tenantNum) {
$tenantInfoByNumber = $this->account_model->getTenantInfoByNumber($tenantNum->to_tenant);
} else {
$tenantInfoByNumber = ""; // fill this in with relevant fill data
}
This should fix your issue, as there is no TenantNum returned, there is no data, so make it yourself for unknown numbers.
The json output is not generated by Ext getcontentbyajax in TYPO3 ver. 4.7. It invokes an 500 Internal server error. In the serverlog i found the error is in line 42 of /lib/class.tx_getcontentbyajax.php.
switch(t3lib_div::_GP('todo')){
I found a 4.7 issue on:
http://lists.typo3.org/pipermail/typo3-german/2012-September/087865.html
t3lib_div::GPvar() changes to t3lib_div::_GP()
When you change all GPvar's to _GP the extension works fine.
Here the changed method main() form /lib/class.tx_getcontentbyajax.php of getcontentbyajax extension:
public function main(){
switch(t3lib_div::_GP('todo')){
case 'pagebrowser':
$href = str_replace(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '', t3lib_div::_GP('href')); // IE6 has problems
$requestedPage = file_get_contents(urldecode(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $href));
/*preg_match('/<div.*?id\=[\"]{0,1}' . t3lib_div::GPvar('part') . '[\"]{0,1}.*?>[\r\n]{0,2}<!--ajaxreplace-->[\s]{0,}(.*?)[\s]{0,}<!--ajaxreplace-->[\r\n]{0,2}<\/div>/s', $requestedPage, $matches);*/
preg_match('/<!--ajaxreplace-->(.*?)<!--ajaxreplace-->/s', $requestedPage, $matchesContent);
preg_match('/<title>(.*?)<\/title>/s', $requestedPage, $matchesTitle);
if(array_key_exists(1, $matchesContent)){
if(array_key_exists(1, $matchesTitle)){
$this->data['title'] = $matchesTitle[1];
}
$this->data['content'] = $matchesContent[1];
$this->data['success'] = true;
} else {
$this->data['content'] = 'An error occured, please reload the site or click this link to load your desired page.';
$this->data['success'] = false;
}
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['getcontentbyajax']['mainHook'])){
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['getcontentbyajax']['mainHook'] as $_classRef){
$_procObj = & t3lib_div::getUserObj($_classRef);
$this->data = $_procObj->extraGlobalMarkerProcessor($this, $this->data);
}
}
break;
}
echo json_encode($this->data);
}
I get this error when I try to access System > Configuration > Advanced > System
Fatal error: Call to a member function toOptionArray() on a non-object in /home/server/public_html/store/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 421
I found this answer: Fatal error: Call to a member function toOptionArray()
However, the code that needs to be replaced according to that answer is different from the code in that file (Form.php):
if ($method) {
if ($fieldType == 'multiselect') {
$optionArray = $sourceModel->$method();
} else {
$optionArray = array();
foreach ($sourceModel->$method() as $value => $label) {
$optionArray[] = array('label' => $label, 'value' => $value);
}
}
} else {
$optionArray = $sourceModel->toOptionArray($fieldType == 'multiselect');
}
$field->setValues($optionArray);
}
}
}
return $this;
Any ideas? Thanks!
If you look in Form.php from line 398 to 425 you have almost the same code. The code from your answer isn't a fix, is just a way to help you determine your real problem, so you can use that code:
if(is_object($sourceModel)){
$field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
} else {
Mage::log($e->source_model);
}
And then you would have to look into the Magento log file to see what happened.
Also you can try to log debug_print_backtrace();
Probably your problem comes from a badly written extension.
The following steps should solve the error:-
Disable Compilation (System -> Tools -> Compilation)
Refresh Cache (System -> Cache Management)