Webtools and developer tools issue on Phalcon framework - php

I installed phalcon 3.0.1-14 on an Ubuntu 14.04 box. Also installed Phalcon DevTools (3.0.1).
Initially, I enabled the webtools and when I visit that page, some warnings appear all the time:
Cannot bind an instance to a static closure in /home/pish/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools.php
Cannot bind an instance to a static closure in /home/pish/vendor/phalcon/devtools/scripts/Phalcon/Web/Tools/views/index.phtml
I just ignored them and tried to create a model out of an existing table in the database. When I clicked on "Generate" button
I get the following error:
Phalcon\Mvc\Dispatcher\Exception: ModelsController handler class cannot be loaded
and the model is not created. I tested creating a controller as well, but a similar error occurred and the controller
was not created either.
Finally, I created the model via the console phalcon model users and it was created successfully.
I noticed, though, that the validation function created by the developer tools doesn't work and causes the following
error when I try to create a user:
Catchable fatal error: Argument 1 passed to Phalcon\Mvc\Model::validate() must implement interface Phalcon\ValidationInterface, instance of Phalcon\Mvc\Model\Validator\Email given in...
My question is basically, is there something bad with the version of developer tools I installed that causes the problems
with the Webtools and the functions that are generated for models/controllers, etc.? Or I might have something wrong
in my system?

Cannot bind an instance to a static closure
https://github.com/phalcon/cphalcon/issues/11029
Catchable fatal error: Argument 1 passed to Phalcon\Mvc\Model::validate()
Fixed in the 3.0.x branch (will be released soon)

Regarding your second error message:
Catchable fatal error: Argument 1 passed to Phalcon\Mvc\Model::validate() must implement interface Phalcon\ValidationInterface, instance of Phalcon\Mvc\Model\Validator\Email given in...
Model validation has changed in Phalcon 3.0. In Phalcon v2 you had to do
public function validation()
{
$this->validate(
new Phalcon\Mvc\Model\Validator\Email(['field' => 'email']);
);
if ($this->validationHasFailed() == true) {
return false;
}
}
But the Phalcon\Mvc\Model\Validation is deprecated in v3 and you should use Phalcon\Validation instead. Just alter your code to the following:
public function validation()
{
$validator = new Validation();
$validator->add(
'email', //your field name
new Phalcon\Validation\Validator\Email([
'model' => $this,
'message' => 'Please enter a correct email address'
])
);
return $this->validate($validator);
}
Maybe the DevTools haven't updated this part yet, I am not sure.

Related

[swagger-codegen][php-symfony] No entrypoint in generated code?

I am attempting to generate a php-symfony server stub using swagger-codgen but I am not getting an index.php (or app.php or anything like that).
When I generate a server stub using the php-silex preset I get an index.php. If I google "silex .htaccess" I can easily find the mod_rewrite directives to get it working. However, when I generate code using the php-symfony preset I cannot find the entry point.
I attempted to combine the php-silex and php-symfony generated codebases (since silex is a symfony project) like so:
(index.php):
use Swagger\Server\Controller\GetTypesListController;
$app->GET('/image/list/types', function (Application $app, Request $request) {
$tlc = new GetTypesListController();
$response = $tlc->getTypeListAction($request);
return $response;
//new Response('How about implementing getTypeList as a GET method ?');
});
However, then I get errors like:
"Fatal error: Uncaught Error: Call to a member function getApiHandler() on null"
I modified the getApiHandler function of my generated GetTypesListController to instantiate the apiServer variable:
public function getApiHandler()
{
if (!isset($this->apiServer)){
$this->apiServer = new \Swagger\Server\Api\ApiServer();
}
return $this->apiServer->getApiHandler('getTypesList');
}
but this just gave me another error:
Undefined property: Swagger\Server\Controller\GetTypesListController::$container
(referencing SymfonyBundle-php/Controller/Controller.php on line 149)
I am obviously doing something wrong. I would really appreciate being pointed in the right direction.
Edit: I do realize that I'm not supposed to call controllers inside controllers.. I assume that I'm not supposed to combine these two generated codebases at all.

Artio Booking is not compatible with Joomla 3.3.6

errors in Artio Booking with Joomla 3.3.6
Fatal error: Declaration of TableReservation::bind() must be
compatible with JTableInterface::bind($src, $ignore = Array)
Fatal error: Declaration of TableSubject::store() must be compatible
with JTableInterface::store($updateNulls = false)
Ok, After some internal plugin coding, I managed to fix this issue.
Replace your files with these in administrator\components\com_booking\tables
Note : Please take a backup before proceeding.
Download
As the error tells you should change function parameter as there in the error -
You should edit your file(inside table folder of component) which has definition of TableReservation class and search for bind function and change
function bind()
to
function bind($src, $ignore = Array)
similarly search for TableSubject class and there change
function store()
to
function store($updateNulls = false)
You should also check on the component site if they provide update.There might be more errors once you fix this.

Fatal error: Call to a member function load() on a non-object Joomla

I have Joomla! 1.7.2 Stable and when I try to Log in to administration area I get this error
Fatal error: Call to a member function load() on a non-object in /home/shomos1/public_html/portal/libraries/joomla/user/user.php on line 822
this is the error line in my user.php
public function load($id)
{
// Create the user table object
$table = $this->getTable();
var_dump($table);
// Load the JUserModel object based on the user id or throw a warning.
if (!$table->load($id)) {
JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('JLIB_USER_ERROR_UNABLE_TO_LOAD_USER', $id));
return false;
}
// Set the user parameters using the default XML file. We might want to
// extend this in the future to allow for the ability to have custom
// user parameters, but for right now we'll leave it how it is.
$this->_params->loadString($table->params);
// Assuming all is well at this point lets bind the data
$this->setProperties($table->getProperties());
return true;
}
}
I am not good in Joomla and I can't understand what is the problem there
please need help what can I do to solve this problem
Thanks
the default com_user component is conflicting with your component so you must rename your component files they must not have name "user" ...

Fatal error: Call to undefined method Zend_XmlRpc_Value::getGenerator() magento

I was upgrading magento when something went wrong and now when I try to login to admin, I am unable to log in to back end admin of magento and I get the following error
Fatal error: Call to undefined method Zend_XmlRpc_Value::getGenerator() in /home/boutique/public_html/app/code/core/Zend/XmlRpc/Request.php on line 413
and the code on respective lines is
/**
* Create XML request
*
* #return string
*/
public function saveXml()
{
$args = $this->_getXmlRpcParams();
$method = $this->getMethod();
$generator = Zend_XmlRpc_Value::getGenerator();
$generator->openElement('methodCall')
->openElement('methodName', $method)
->closeElement('methodName');
I cant understand why this issue is happening, I tried replacing request.php and response.php files from fresh download of magento..
can body help me? why this eror is popping?
There's something about your installation of PHP and Magento that's broken — for some reason the Zend_XmlRpc_Value object that's instantiated doesn't contain a getGenerator method. The class for this object is normally defined in
lib/Zend/XmlRpc/Value.php
However, it's possible there may be a class override in place at
app/code/core/Zend/XmlRpc/Value.php
app/code/community/Zend/XmlRpc/Value.php
app/code/local/Zend/XmlRpc/Value.php
It's also possible your system may have another version of the zend framework installed somewhere in the PHP include path.

Fatal error with Custom Magento Module on one server but not the other

I am creating my own custom module in Magento and during testing on a Litespeed server (PHP v5.2.14) I am getting a Fatal Error: Call to a member function batch() on a non-object in ../../../BatchController.php on line 25 that was not appearing during testing on another linux server and a wamp server (PHP v5.2.11).
This one has stumped me. I am guessing it has something to do with the server configuration rather than the code itself. But i am just guessing. I was hoping someone here could tell me.
The only real major difference I could see, aside from the php versions and environment, is that the server that the error is on is using the Suhosin Patch. But would that be something that could cause this?
The line in question is Mage::getModel('mymodule/mymodel')->batch(); which is enclosed in an IF statement. batch() is a public function located in my model file.
If you need more code let me know.
Thanks!
If you get a "non-object" error when calling a model, there's a problem with Magento's attempt to get your model class, and it is returning null. The reasons for this are not always apparent. If this worked identically on a normal LAMP stack, then the problem is most likely not in your code.
My first guess would be that the file does not have the proper permissions. Otherwise, it may have to do with resolving the classname. You could test this temporarily by calling the plugin directly like this:
$obj = new Mynamespace_Mymodule_Model_Mymodel();
$obj->batch();
If this works, then the file is readable, and you will want to go spelunking in the resolution of that classname. If it doesn't work, you have a problem with either autoloading or the declaration of your class.
Hope that helps!
Thanks,
Joe
Break it down.
You've tried to call
Mage::getModel('mymodule/mymodel')->batch();
and PHP told you it tried to call the method batch on a non-object. That means
Mage::getModel('mymodule/mymodel')
isn't returning a Model object the way it's supposed to.
First thing to do is clear out your Magento cache on the server you're having problems with. If your Module's config hasn't been loaded into the global config tree Magento will try to instantiate a Mage_Core_Model_Mymodel, and fail.
Second step is to make sure your module's app/etc/module file is in place.
Third step is to add some debugging (assuming a 1.4 branch) to the method that instantiates your objects and determine why Magento can't create your object
File: app/code/core/Mage/Core/Model/Config.php
...
public function getModelInstance($modelClass='', $constructArguments=array())
{
$className = $this->getModelClassName($modelClass);
if (class_exists($className)) {
Varien_Profiler::start('CORE::create_object_of::'.$className);
$obj = new $className($constructArguments);
Varien_Profiler::stop('CORE::create_object_of::'.$className);
return $obj;
} else {
#throw Mage::exception('Mage_Core', Mage::helper('core')->__('Model class does not exist: %s.', $modelClass));
return false;
}
}
...

Categories