Pipedrive Class not found? - php

I am facing a strange error. I got a fairly simple piece of code yet it is constantly giving me error that class not found.
The error i am getting is
Fatal error: Class 'pipedriveintegrationConfig' not found in /home/preston/public_html/fullslate-pipedrive/index.php on line 4
Here is index.php
require_once 'config.php';
require_once pipedriveintegrationConfig::PHP_LIB;
require_once 'fullslate.php';
require_once 'pipedrive.php';
require_once 'fullslate-pipedrive.php';
pipedriveintegrationConfig::init();
if ($_SERVER['argc'] > 1) {
$action = $_SERVER['argv'][1];
} else
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if ($action) {
switch($action) {
case 'sync-clients':
$client = new pipedriveintegrationFullslatePipedrive(pipedriveintegrationFullslateConfig::toArray(), pipedriveintegrationPipedriveConfig::toArray());
$client->syncClients();
break;
default:
throw new CustomException('Unknown command line action: ', $action);
break;
}
} else {
if (file_exists(__DIR__ . '/test.php')) {
require_once __DIR__ . '/test.php';
}
}
Code for config.php is
namespace pipedriveintegration;
class PipedriveConfig{
const URL = 'https://api.pipedrive.com/v1';
const API_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXX';
const STAGE_ID_NEW_PROSPECT = 1;
const STAGE_ID_CONSULTATION_SCHEDULED = 3;
public static
function toArray() {
return array('url' => self::URL, 'api_token' => self::API_TOKEN, 'stage_id_new_prospect' => self::STAGE_ID_NEW_PROSPECT, 'stage_id_consultation_scheduled' => self::STAGE_ID_CONSULTATION_SCHEDULED,);
}
}
class FullslateConfig{
const URL = 'https://slcguitar.fullslate.com/api';
const API_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXx';
public static
function toArray() {
return array('url' => self::URL, 'api_token' => self::API_TOKEN,);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
class Config{
const PHP_LIB = 'PHPLib.php';
const USE_TIMESTAMP = false;
//'2014-12-15';
public static
function init() {
APP::init(array('mode' => 'development','log' => array('level' => Log::LEVEL_ALL, 'append' => true, 'limit' => 10,), 'curl' => array('log' => false, 'retry' => 3,),'temp' => array('path' => __DIR__, 'active' => true,),));
}
}
class PDEBUG{
const USE_FIDDLER = false;
}
Not sure wrong I am doing?

You need to change the require to:
require_once \pipedriveintegration\Config::PHP_LIB;
Your namespace is pipedriveintegration not pipedriveintegrationConfig. Also the constant is inside the class Config.
I don't know which PHP version are you using but I tested this in 5.6 and it works.

Please remove API tokens, and regenerate them in the application, by publishing API token you are giving access to your account to everyone.

Related

How to get redis key value with class function and init file

In my project, I use redis.
And I have a init file including ip port and port, so class Datasource is used for analying init file and connecting redis.
Here is class Datasource.php code with function getRedis() in it:
namespace common;
class Datasource {
public function __construct() {}
public static function getRedis($config_name = NULL, $server_region = 'default') {
global $config;
$redis_config = $config['redis'][$config_name];
if ($config_name && $redis_config && $server_region) {
$this->_config_name = $config_name;
$this->_redis_config = $redis_config;
$this->_server_region = $server_region;
try {
$this->_redis = new \Redis();
$this->_redis->connect($this->_redis_config[$server_region]['host'], $this->_redis_config[$server_region]['port']);
if($this->_redis_config[$server_region]['password'] && !$this->_redis->auth($this->_redis_config[$server_region]['password'])) {
$this->_redis = null;
}
} catch (Exception $e) {
$this->_redis = null;
}
} else {
$this->_redis = null;
}
return self::$this->_redis;
}
}// end of class Datasource
Here is init file code of redis.ini.php
<?php
$config['redis']['instance1'] = array(
'default' => array(
'host' => '127.0.0.1',
'port' => '6379',
'timeout' => 5,
'pconnect' => 1,
'password' => '',
)
);
$config['redis']['instance2'] = array(
'default' => array(
'host' => '127.0.0.1',
'port' => '6379',
'timeout' => 5,
'pconnect' => 1,
'password' => '',
)
);
Now I want to get xie value which is in redis, Here is my html code:
<body style="height:100%" >
<?php
include "o1ws1v/class/common/Datasource.php";
include 'o1ws1v/conf/redis.ini.php';
$redis_obj = common\Datasource::getRedis('instance1');
$value = $redis_obj->get("xie");
echo "get key xie is:".$value."\n";
?>
</body>
Actually, key xie should be zuo. The corrent result is a line : "get key xie is:zuo"
But it showed nothing, Who can help me?
You use $this in a static method, and you can't. Additionaly, you catch all Exceptions while connecting to Redis, so you can't know why it wasn't unsuccessful. You need to do two things:
Turning on PHP errors (for development only of course)
Don't catch the Exceptions while connecting, and if you do - then log / keep the Exception's message.
Try something like this:
<?php
namespace common;
class Datasource
{
private static $_redis, $_config_name, $_redis_config, $_server_region;
public static function getRedis($config_name = NULL, $server_region = 'default')
{
error_reporting(E_ALL);
ini_set("display_errors", true);
global $config;
$redis_config = $config['redis'][$config_name];
if (!$config_name || !$redis_config || !$server_region) {
throw new \Exception('$config_name or $redis_config or $server_region is not set');
}
if (!$redis_config[$server_region]['password']) {
throw new \Exception('Redis password is not set');
}
self::$_config_name = $config_name;
self::$_redis_config = $redis_config;
self::$_server_region = $server_region;
self::$_redis = new \Redis();
self::$_redis->connect(self::$_redis_config[$server_region]['host'], self::$_redis_config[$server_region]['port']);
if (!self::$_redis->auth(self::$_redis_config[$server_region]['password'])) {
throw new \Exception("Can't login to Redis. Check password");
}
return self::$_redis;
}
}
And the error displaying code is obviously not belong here, it's just for you to see if there are any errors temporarly.
Also, I would add a condition to see if Redis is already set, then return the connection. Otherwise you will make another connection every time you call getRedis method. Something like this:
public static function getRedis(...)
{
if (!self::$_redis) {
...
}
return self::$_redis;
}

Phalcon Login failure (getDI)

I'm using PHP on IIS, Phalcon framework. I have a login controller which I'm working on (yes, password isn't encrypted yet, but that's later) but I can't seem to get it to work.
I have a form action posting to signin/doSignin. This is a snippet of the SigninController.php:
public function doSigninAction(){
//$this->view->disable();
$user = User::findFirst([
'conditions' => 'email = :email: AND password = :password:'
, 'bind' => [
'email' => $this->request->getPost('email')
, 'password' => $this->request->getPost('password')
]
]);
if ($user){
echo 1;
return;
}
echo 2;
What results when I run this code is a blank page that simply reports:
Call to undefined method or service 'getDI'
Something somewhere is not lined up properly for the internals of phalcon, but I don't know what I need to check. When I change the above code to this, I get a proper rendering of the view, printing 1 for the user:
$user = new User()/*::findFirst([
'conditions' => 'email = :email: AND password = :password:'
, 'bind' => [
'email' => $this->request->getPost('email')
, 'password' => $this->request->getPost('password')
]
]);*/;
if ($user){
echo 1;
return;
}
echo 2;
My bootstrap is the following:
<?php
try {
set_include_path('c:/workspace/GIIAnalytics/app/views');
//Autoloader
$loader = new \Phalcon\Loader();
$loader->registerDirs([
'../app/controllers/'
, '../app/models/'
, '../app/config/'
]);
/** For MSSQL connections */
$loader->registerNamespaces([
"Twm\Db\Adapter\Pdo" => "../app/library/db/adapter/"
, "Twm\Db\Dialect" => "../app/library/db/dialect/"
]);
$loader->register();
//Dependancy Injection
$di = new \Phalcon\DI\FactoryDefault();
//Config
$configFile = __DIR__ . '/../app/config/config.json';
$config = json_decode ( file_get_contents ( $configFile ) );
$di->setShared('config',$config);
//MSSQL Database connection
$di->set("db", function() use ($di) {
//Database info
/** For MSSQL connections */
$mc = $di->getDI()->getShared('config')['db'];
$db = new Twm\Db\Adapter\Pdo\Mssql($mc);
return $db;
});
//View
$di->set('view', function(){
$view = new \Phalcon\Mvc\View();
$view->setViewsDir('../app/views');
/*
$view->registerEngines([
'.volt' => '\Phalcon\Mvc\View\Engine\Volt'
]);
*/
return $view;
});
// Router
$di->set('router',function(){
$router = new \Phalcon\Mvc\Router();
$router->mount(new Routes());
return $router;
});
// Session
$di->setShared('session', function() {
$session = new \Phalcon\Session\Adapter\Files();
$session->start();
return $session;
});
//Flash Data (temp data)
$di->set('flash', function() {
$flash = new \Phalcon\Flash\Session([
'error' => 'alert alert-danger'
, 'success' => 'alert alert-success'
, 'notice' => 'alert alert-info'
, 'warning' => 'alert alert-warning'
]);
return $flash;
});
//Metadata
$di['modelsMetadata'] = function() {
$metaData = new \Phalcon\Mvc\Model\MetaData\Memory([
'lifetime' => 86400
, 'prefix' => 'metaData'
]);
return $metaData;
};
// custom dispatcher overrides the default
$di->set('dispatcher', function() use ($di) {
$eventsManager = $di->getShared('eventsManager');
// Custom ACL class
$permission = new Permission();
// Listen for events from the $permission class
$eventsManager->attach('dispatch', $permission);
$dispatcher = new \Phalcon\Mvc\Dispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
//Deploy the app
$app = new \Phalcon\Mvc\Application($di);
echo $app->handle()->getContent();
} catch(\Phalcon\Exception $e) {
echo $e->getmessage();
}
?>
How do I fix the dependency problem?
Found the issue. Phalcon is not good about giving you the line for invalid function calls. It was in my db constructor, where I'm doing $di->getDI this got changed (along with the config reader) to this snippet:
//MSSQL Database connection
$di->set("db", function() use ($di) {
//Database info
/** For MSSQL connections */
$mc = (array) $di->getShared('config')->db;
$db = new Twm\Db\Adapter\Pdo\Mssql($mc);
return $db;
});

Phalcon 3 and PHP 7 breaking the existing site

My problem started right after I upgraded PHP to Version 7 and Phalcon to Version 3.
Problem
I m getting blank page, no error messages (Error is turned on), no `500 Internal server' error in console. The site used to work flawlessly before.
I have following controller IndexController.php
<?php
namespace RealEstate\Property\Controllers;
use \Phalcon\Mvc\Controller;
use \Phalcon\Mvc\View;
use RealEstate\Common\Models as CommonModels;
class IndexController extends Controller
{
public function initialize(){
//Code here
}
public function indexAction(){
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
$this->view->setVar("total_properties", $this->utils->getTotalProperties());
$this->view->pick("index");
echo "HELLO WORLD";
}
}
The index action doesnot render anything, but yes HELLO WORLD is printed, so there seems there is no errors in code above that line.
My bootstrap index.php
<?php
namespace RealEstate;
use \Phalcon\Mvc\Application;
use \Phalcon\DI\FactoryDefault;
use \Phalcon\Loader;
use \Phalcon\Mvc\Router;
use \Phalcon\Mvc\View;
use \Phalcon\Mvc\Dispatcher;
use \Phalcon\Events\Manager as EventManager;
use \Phalcon\Assets\Manager as Assets;
use \Phalcon\Mvc\Url as UrlProvider;
use \Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use \Phalcon\Flash\Session as FlashSession;
use \Phalcon\Session\Adapter\Files as SessionAdapter;
use \Phalcon\Http\Response\Cookies;
//use \Phalcon\Session\Adapter\Files as Session;
class MyApplication extends Application
{
const DEFAULT_MODULE = "property";
private $prConfig;
/**
* Register the services here to make them general or register in the ModuleDefinition to make them module-specific
*/
protected function _registerServices()
{
try{
$config = include "../apps/config/config.php";
$di = new FactoryDefault();
$loader = new Loader();
/**
* We're a registering a set of directories taken from the configuration file
*/
$loader->registerDirs(
array(
__DIR__ . '/../apps/library/',
__DIR__ . '/../apps/plugins/'
)
);
$loader->registerNamespaces(array(
'RealEstate\Common\Plugins' => '../apps/plugins/',
'RealEstate\Common\Models' => '../apps/common/models/',
'RealEstate\Library\Pagination' => '../apps/library/',
'Facebook' => __DIR__.'/../apps/plugins/FacebookSDK/'
));
$loader->registerClasses(array(
"FacebookLib" => __DIR__.'/../apps/library/FacebookLib.php',
"Facebook" => __DIR__.'/../apps/plugins/FacebookSDK/autoload.php',
"MobileDetect" => __DIR__.'/../apps/library/MobileDetect.php'
));
$loader->register();
$di->set('config', $config, true);
//Register assets like CSS and JS
$di->set("assets",function(){
$assets = new Assets();
$cdnUrl = $this->cdnurl;
//Add CSS to collection. "true" means we're using base url for css path
$assets->collection('css')->addCss($cdnUrl.'assets/css/frontend/combined.css?v=44');
$assets->collection('footer')->addJs($cdnUrl.'assets/js/frontend/combined.js?v=44', false);
return $assets;
});
$this->prConfig = $config;
//register base url
$di->set('baseurl', function() use ($config){
$url = $config->application->baseUri;
return $url;
});
//register CDN url
$di->set('cdnurl', function() use ($config){
$url = $config->application->cdnUri;
return $url;
});
//Module Information
$di->set('appconfig', function() use ($config){
$appconfig = $config->application;
return $appconfig;
});
//Register URL helper
//set base url
$di->set('url', function() use ($config){
$url = new UrlProvider();
$url->setBaseUri($config->application->baseUri);
return $url;
});
//Register dependency for a database connection
$di->setShared('db', function() use ($config){
return new DbAdapter(array(
"host" => $config->database->host,
"username" => $config->database->username,
"password" => $config->database->password,
"dbname" => $config->database->dbname
));
});
//Register and start session
$di->setShared('session', function() {
$session = new SessionAdapter();
$session->start();
return $session;
});
//Register custom library Utilities, so that it is available through out the application
$di->setShared("utils",function(){
return new \Utilities();
});
//Registering a router
$di->set('router', function() use ($config){
$router = new Router(false);
$controller = "index";
/*Backend Routers Configuration Start*/
$modules = $config->modules;
$router->add('/', array(
'module' => 'property',
'namespace' => 'RealEstate\Property\Controllers\\',
'controller' => 'index',
'action' => 'index'
));
$router->add('/:int', array(
'module' => 'property',
'namespace' => 'RealEstate\Property\Controllers\\',
'controller' => 'index',
'action' => 'index',
'params' =>1
));
//other router settings
$router->notFound(array(
'module' => 'errors',
'namespace' => 'RealEstate\Errors\Controllers\\',
'controller' => 'index',
'action' => 'show404'
));
$router->removeExtraSlashes(true); //ignore trailing slash in urls
/*Backend Routers Configuration End*/
return $router;
});
$di->set('partials', function() {
$partials = new View();
$partials->setPartialsDir('../apps/common/views/');
return $partials;
});
$this->setDI($di);
}catch(\Phalcon\Exception $e){
echo get_class($e), ": ", $e->getMessage(), "\n";
echo " File=", $e->getFile(), "\n";
echo " Line=", $e->getLine(), "\n";
echo $e->getTraceAsString();
}
}
public function main()
{
try{
if (!extension_loaded('phalcon')) {
die("Phalcon extension is not installed or enabled. Please check with host");
}
$this->_registerServices();
if($this->prConfig->application->environment=="development" || $_GET["showerrors"]==1){
ini_set("display_errors","On");
error_reporting(E_ALL ^ E_NOTICE);
}
$arraytemp = json_decode(json_encode($this->prConfig->modules), true); //convert Config object to a simple array
//$this->utils->printr($arraytemp,1);
$keys = array_keys($arraytemp);
$array = array();
if(count($keys)>0){
foreach($keys as $module){
$array[$module]["className"] = "RealEstate\\".ucwords($module)."\Module";
$array[$module]["path"] = "../apps/modules/".$module."/Module.php";
}
}else{
die("The entries for modules not found.");
}
$this->registerModules($array);
echo $this->handle()->getContent();
}catch(\Phalcon\Exception $e){
echo get_class($e), ": ", $e->getMessage(), "\n";
echo " File=", $e->getFile(), "\n";
echo " Line=", $e->getLine(), "\n";
echo $e->getTraceAsString();
}
}
}
$application = new MyApplication();
$application->main();
Have followed This Link as well, but with not much help.
UPDATE
No errors on Server's error log
Thanks
I think I solved this issue. The issue was in Module.php, the issue was in method
public function registerServices($di)
{
try{
//Registering the view component
$di->set('view', function() {
$view = new View();
$view->setViewsDir('../apps/modules/'.$this->module_name.'/views/');
return $view;
});
}catch(\Phalcon\Exception $e){
echo get_class($e), ": ", $e->getMessage(), "\n";
echo " File=", $e->getFile(), "\n";
echo " Line=", $e->getLine(), "\n";
echo $e->getTraceAsString();
}
}
Where, $module_name is a property defined in class.
In above code $this->module_name was undefined. so I changed above method to -
public function registerServices($di)
{
$module = $this->module_name;
try{
//Registering the view component
$di->set('view', function() use($module) {
$view = new View();
$view->setViewsDir('../apps/modules/'.$module.'/views/');
return $view;
});
}catch(\Phalcon\Exception $e){
echo get_class($e), ": ", $e->getMessage(), "\n";
echo " File=", $e->getFile(), "\n";
echo " Line=", $e->getLine(), "\n";
echo $e->getTraceAsString();
}
}
I wondered why it was working in previous version of Phalcon

Class 'ZendSearch\Lucene\Lucene' not found [duplicate]

I've installed ZendSearch with composer using these commands:
$ cd /var/www/CommunicationApp/vendor/
$ git clone https://github.com/zendframework/ZendSearch.git
ZendSearch
$ cd ZendSearch/
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install
And I've installed Zendskeleton according to GITHUB
So, I don't know What I'm missing here.
Than, in the same book, it teaches how to use ZendSearch, but I'm not getting the same results, instead I'm getting a Fatal error: Fatal error: Class 'ZendSearch\Lucene\Lucene' not found in /var/www/CommunicationApp/module/Users/src/Users/Controller/SearchController.php on line 107
<?php
namespace Users\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Http\Headers;
use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Adapter\DbTable as DbTableAuthAdapter;
use Users\Form\RegisterForm;
use Users\Form\RegisterFilter;
use Users\Model\User;
use Users\Model\UserTable;
use Users\Model\Upload;
use Users\Model\ImageUpload;
use Users\Model\ImageUploadTable;
use ZendSearch\Lucene;
use ZendSearch\Lucene\Document;
use ZendSearch\Lucene\Index;
class SearchController extends AbstractActionController
{
protected $storage;
protected $authservice;
public function getAuthService()
{
if (! $this->authservice) {
$this->authservice = $this->getServiceLocator()->get('AuthService');
}
return $this->authservice;
}
public function getIndexLocation()
{
// Fetch Configuration from Module Config
$config = $this->getServiceLocator()->get('config');
if ($config instanceof Traversable) {
$config = ArrayUtils::iteratorToArray($config);
}
if (!empty($config['module_config']['search_index'])) {
return $config['module_config']['search_index'];
} else {
return FALSE;
}
}
public function getFileUploadLocation()
{
// Fetch Configuration from Module Config
$config = $this->getServiceLocator()->get('config');
if ($config instanceof Traversable) {
$config = ArrayUtils::iteratorToArray($config);
}
if (!empty($config['module_config']['upload_location'])) {
return $config['module_config']['upload_location'];
} else {
return FALSE;
}
}
public function indexAction()
{
$request = $this->getRequest();
if ($request->isPost()) {
$queryText = $request->getPost()->get('query');
$searchIndexLocation = $this->getIndexLocation();
$index = Lucene\Lucene::open($searchIndexLocation);
$searchResults = $index->find($queryText);
}
// prepare search form
$form = new \Zend\Form\Form();
$form->add(array(
'name' => 'query',
'attributes' => array(
'type' => 'text',
'id' => 'queryText',
'required' => 'required'
),
'options' => array(
'label' => 'Search String',
),
));
$form->add(array(
'name' => 'submit',
'attributes' => array(
'type' => 'submit',
'value' => 'Search',
'style' => "margin-bottom: 8px; height: 27px;"
),
));
$viewModel = new ViewModel(array('form' => $form, 'searchResults' => $searchResults));
return $viewModel;
}
public function generateIndexAction()
{
$searchIndexLocation = $this->getIndexLocation();
$index = Lucene\Lucene::create($searchIndexLocation);
$userTable = $this->getServiceLocator()->get('UserTable');
$uploadTable = $this->getServiceLocator()->get('UploadTable');
$allUploads = $uploadTable->fetchAll();
foreach($allUploads as $fileUpload) {
//
$uploadOwner = $userTable->getUser($fileUpload->user_id);
// id field
$fileUploadId= Document\Field::unIndexed('upload_id', $fileUpload->id);
// label field
$label = Document\Field::Text('label', $fileUpload->label);
// owner field
$owner = Document\Field::Text('owner', $uploadOwner->name);
if (substr_compare($fileUpload->filename, ".xlsx", strlen($fileUpload->filename)-strlen(".xlsx"), strlen(".xlsx")) === 0) {
// index excel sheet
$uploadPath = $this->getFileUploadLocation();
$indexDoc = Lucene\Document\Xlsx::loadXlsxFile($uploadPath ."/" . $fileUpload->filename);
} else if (substr_compare($fileUpload->filename, ".docx", strlen($fileUpload->filename)-strlen(".docx"), strlen(".docx")) === 0) {
// index word doc
$uploadPath = $this->getFileUploadLocation();
$indexDoc = Lucene\Document\Docx::loadDocxFile($uploadPath ."/" . $fileUpload->filename);
} else {
$indexDoc = new Lucene\Document();
}
$indexDoc->addField($label);
$indexDoc->addField($owner);
$indexDoc->addField($fileUploadId);
$index->addDocument($indexDoc);
}
$index->commit();
}
}
The book is giving you weird instructions because it says Zend Search cannot be installed via. Composer, but this is no longer the case not quite true. To fix:
Delete your vendor folder
Edit your composer.json and add zendframework/zendsearch to the require section
Run php composer.phar install to install all packages (including Zend Search)
Then everything should be working.
Edit: okay, for some reason this package isn't listed on packagist. You'll also need to add the repo URL to your composer.json:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/zendframework/ZendSearch"
}
],
then give it another try.
You should put zendsearch in zendframework in vendor folder and after installing it as the book said, you should insert this line at the end of vendor/composer/autoload_namespaces.php:
'ZendSearch' => array($vendorDir . '/zendframework/zendsearch/library')

Cant understand what's happening

i'm trying Zend framework, i've got two folders in E:\Archivos de programa\Zend\ZendServer\share, une is ZendServer and the other one is ZendServer2
I can't recall if i ever install this two version but i dont think this is the problem
I'm using netbeans as ide ando i'm trying to make an ABM of users using BlockCipher
Here is my code
<?php
use Zend\Crypt\BlockCipher;
class Application_Model_DbTable_Usuarios extends Zend_Db_Table_Abstract
{
protected $_name = 'usuario';
public function getUsuario($usuario)
{
$usuario = (string)$usuario;
$row = $this->fetchRow('Usuario = ' . $usuario);
if (!$row) {
throw new Exception("Could not find row $usuario");
}
return $row->toArray();
}
public function addUsuario($usuario, $clave)
{
$blockCipher = Zend\Crypt\BlockCipher::factory('mcrypt',array('algo'=>'aes'));
$blockCipher->setKey('encryption key');
$result = $blockCipher->encrypt($clave);
echo "Encrypted text: $result \n";
exit;
$data = array(
'Usuario' => $usuario,
'Clave' => $blockCipher,
);
$this->insert($data);
}
public function updateUsuario($usuario, $clave)
{
$blockCipher = BlockCipher::factory($clave, array(
'algo' => 'blowfish',
'mode' => 'cfb',
'hash' => 'sha512'
));
$data = array(
'Clave' => $blockCipher,
);
$this->update($data, 'Usuario = ' . (string)$usuario);
}
public function deleteUsuario($usuario)
{
$this->delete('Usuario = ' . (string)$usuario);
}
}
and in my php.ini i've got
include_path=".;E:\Archivos de programa\Zend\ZendServer\share\ZendFramework2\library"
And i get this error
Fatal error: Class 'Zend\Crypt\BlockCipher' not found in E:\Documents and Settings\dvieira\Mis documentos\NetBeansProjects\justforgeeks\application\models\DbTable\Usuarios.php on line 21
I dont understand why.
Can you help me please?
Thanks in advance
You are using namespaces in your application, therefore you need to make sure that your autoloader can handle this. If it's a ZF1 app then not. Can you try using require to include the class file instead? You can ass well amend the autoloader to work with namespaces
Secondly when using namespaces, if you create an alias for a class
use Zend\Crypt\BlockCipher;
you then instantiate it
$blockCipher = BlockCipher::factory('mcrypt',array('algo'=>'aes'));

Categories