Create a new product in the invo tutorial

Hi Everyone, I'm having a problem with the ProductController line 101 of the Invo test application

if (!$form->isValid($data, $product)) {

For some reasons this is throwing an exception with message 'Wrong number of parameters'.

POST data is correctly received.

Someone has an idea of why I get this error?


Ok, got it. To get rid of the error

Fatal error: Class 'Phalcon\Validation\Validator\Numericality' not found in /mypath/app/forms/ProductsForm.php on line 54

that is in the product add page, I edited the path of the class Numericality to

use Phalcon\Mvc\Model\Validator\Numericality;

but apparently something is still wrong. So I commented the adding of this validator for the 'price' field and saving is now working.

So what is the correct path for the Numericality validator?

I use Phalcon version 1.3.2 with PHP version 5.4.34


edited Nov '14

I did not see Numericality validation in documentation, Phalcon\Validation\Validator\Numericality . You can see all rules here

Hi vitaliykoziy, exactly. But I've found this

so I thought that changing the path will do the work, but unfortunatelly this break the creation of a new product (also see this discussion ), clearly not the same class.

The use of this validator exists within the Productform class of the Invo application on line 9

Only totally removing this validator will make the creation of a new product work.

edited Nov '14

In Try add new namespace

use Phalcon\Forms\Element\Numeric;

and write this

$price = new Numeric("price");
        new PresenceOf(array(
            'message' => 'Price is required'

I think this will do that you want.

P.S. I don't use model validation rules for form validation.

Thank you, I'll try this.

However I don't understand how that part of the Invo code is supposed to work, I really would like to know this...


That INVO tutorial is adapted to Phalcon 2.0, that's why you find that missing class

Thanks Phalcon, so shouldn't the README of the Github repo be updated showing

Required version: >= 2.0.0

instead of the current

Required version: >= 1.0.0 ?

Is really a good idea to start develop an application using Phalcon 1.3.x?