We are using the propel ORM along with the phalcon framework and are facing the same issue.
This solution is not relevant to us since we do not have phalcon ORM classes.
Some additional info
Code:
<?php
namespace Modules\Frontend\Forms\Application;
use Library\Form\BaseForm;
use Phalcon\Forms\Element\Submit;
use Phalcon\Forms\Element\TextArea;
use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\StringLength;
class ApplicationMessageForm extends BaseForm
{
const TARGET_METHOD = 'POST';
const MESSAGE = 'message';
/**
*
* @return array|void
*/
public function initialize()
{
if($this->getUserOptions() && isset($this->getUserOptions()['target_action'])) {
$this->setAction($this->getDI()->get('url')->get($this->getUserOptions()['target_action']));
}
// email field
$attributes = ['rows' => 6];
$messageField = new TextArea(self::MESSAGE, $attributes);
//$messageField->setLabel(48'label.' . self::MESSAGE));
$messageField->addValidators(
array(
new PresenceOf(array("message" => $this->t('please.enter.a.message'), "cancelOnFail" => true)),
new StringLength(array(
'max' => 50,
'min' => 5,
'messageMaximum' => 'We don\'t like really long names',
'messageMinimum' => 'We want more than just their initials'
)
)
)
);
$messageField->setFilters(array("trim"));
$this->add($messageField);
// submit field
$this->add(
new Submit(
"submit", array(
"value" => "Send",
"class" => "btn btn-info pull-right everjobs-btn"
)
)
);
}
}
SQL data looks as following:
+------------------------+---------+--------------------+-----------------------------+---------------------+---------------------+
| id_application_message | fk_user | fk_job_application | text | created_at | updated_at |
+------------------------+---------+--------------------+-----------------------------+---------------------+---------------------+
| 1 | 41671 | 1 | lorem ipusum | 2015-03-17 10:06:19 | 2015-03-17 10:06:19 |
| 2 | 41671 | 2 | dev | 2015-03-17 10:52:31 | 2015-03-17 10:52:31 |
| 3 | 41673 | 2 | lorem ipusum toler del amon | 2015-03-17 11:37:47 | 2015-03-17 11:37:47 |
| 4 | 41673 | 2 | | 2015-03-17 20:03:03 | 2015-03-17 20:03:03 |
| 5 | 41673 | 2 | | 2015-03-17 20:03:07 | 2015-03-17 20:03:07 |
| 6 | 41673 | 2 | | 2015-03-17 20:30:38 | 2015-03-17 20:30:38 |
| 7 | 41673 | 2 | | 2015-03-17 21:10:36 | 2015-03-17 21:10:36 |
| 8 | 41673 | 2 | | 2015-03-17 21:10:37 | 2015-03-17 21:10:37 |
| 9 | 41673 | 2 | | 2015-03-18 09:36:33 | 2015-03-18 09:36:33 |
| 10 | 41671 | 2 | thanks | 2015-03-18 09:43:54 | 2015-03-18 09:43:54 |
| 11 | 41673 | 2 | | 2015-03-18 10:09:56 | 2015-03-18 10:09:56 |
| 12 | 41673 | 2 | | 2015-03-18 10:40:46 | 2015-03-18 10:40:46 |
| 13 | 41673 | 2 | fdsfdsfds | 2015-03-18 10:41:08 | 2015-03-18 10:41:08 |
| 14 | 41673 | 2 | fdsfds | 2015-03-18 10:41:19 | 2015-03-18 10:41:19 |
| 15 | 41673 | 2 | fd | 2015-03-18 10:55:37 | 2015-03-18 10:55:37 |
| 16 | 41673 | 2 | | 2015-03-18 11:00:19 | 2015-03-18 11:00:19 |
| 17 | 41673 | 2 | | 2015-03-18 11:16:50 | 2015-03-18 11:16:50 |
+------------------------+---------+--------------------+-----------------------------+---------------------+---------------------+
e.g empty strings and not NULL
Thanks!