How to Check which validation is violated for a model in Yii2 - yii2-advanced-app

when I print ths statement inside a model as,
Yii::error($this->validate());
it gives me
false
QUESTION :
How can I check which validation is getting violated? As I have 38 parameters with different rules, I am tired debugging application. any help?

You can get the errors for your model this way:
$this->getErrors();
Reference:
Class yii\base\Model->getErrors() documentation

Related

React hook form dynamic fields validations

My task is to implant a functionality that includes dynamically creation of fields and apply validation on those dynamically created fields.
I have found a prefect example that fits my use case which is here (https://stackblitz.com/edit/react-hook-form-dynamic-form-example) but the issue that I am facing is every time I try to download the example from stackblitz and run locally I get error below error:
{"tickets":{"message":"tickets must be a `array` type, but the final value was: `null` (cast from the value `{\n \"0name\": \"\\\"\\\"\",\n \"0email\": \"\\\"\\\"\",\n \"1name\": \"\\\"\\\"\",\n \"1email\": \"\\\"\\\"\"\n}`).\n If \"null\" is intended as an empty value be sure to mark the schema as `.nullable()`","type":"typeError"}}
I am wondering if someone could help me run this example locally, rest I can work out.
Many thanks :)

e.forEach is not a function

I have a simple scenario wherein I have to display data in the grid. I have worked with similar scenarios before but I'm not sure why this error is coming.
The error in console says : e.forEach is not a function at at e.recursiveFunction (ag-grid-enterprise.min.js:2)
This doesn't point to a specific piece of code that I've written. I'm using ag-grid with angular 1.
Can someone please help me understand what might be causing this?

How to write mapping conditions in Devart's Entity Developer

Does anybody know how to use the "Conditions" feature in the "Mapping Details" option of the Model.
I have tried adding Conditions like "IsDeleted = False" or "IsDeleted = 0" and nothing works. Just get errors.
Many thanks.
It seems that one cannot use a mapped property. Once I removed this, the condition worked. However this means that one cannot update this property via EF, and instead one has to use raw DDL via ExecuteStoreCommand.
Hope this helps someone. It got me scratching my head !!

Symfony2 validation constraint 'Symfony\Component\Validator\Constraints\MaxLength' not found

I am new to Symfony and frameworks so have been following the Symblog tutorial but have become stuck when validating the forms.
Get this error...
FatalErrorException: Error: Class
'Symfony\Component\Validator\Constraints\MaxLength' not found in
/Applications/MAMP/htdocs/Portfolio/Symfony/src/Blogger/BlogBundle/Entity/Enquiry.php
line 71
Where am I going wrong?
B
MaxLength is deprecated since symfony 2.1 use Length with the max option set.
The reference can be found in UPGRADE-2.1.md in the validator section.

How can I diagnose this critical error? Zend_Db and PHPUnit

I have an action in a model that adds a record to a table. It works fine when I test it by typing values in to the browser, but is failing when I test it with PHPUnit. The frustrating part is that I don't really know how to diagnose the problem.
The unit test has a (rather long) $data array, and the problem occurs when I call the dbTable->insert($data) method. The log shows:
CRIT (2): Application Error
CRIT (2): Request Parameters
How can I get more information on these errors? The line following the offending line is not executed.
Thanks!
Ok, so I had a boolean field in the DB that was not nullable. It showed a default value of 0, so I assumed that I didn't need to provide this field in the insert statement. Seems I was wrong.
As soon as I provided a value for this field it worked fine.
Something else that confused this issue is that I had assumed I'd get a more descriptive error in my log if was such a simple error ...