Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Help,afterCreate doesn't work

There are two Mysql(5.1.73) tables, tableA and tableB. I want to insert three records into tableB when I have insert a record into tableA.So I used afterCreate method

    public function afterCreate()
        $info = json_decode($this->getInfo(),true);
        foreach ($info as $key => $val) {
            $log = new BdLogs();

            $tmp = explode('_', $val['account']);

            $log->setCreated(date('Y-m-d H:i:s'));
            //print_r($log->toArray()); it is right!!!
            try {
            } catch (Exception $e) {
                throw new Exception($e->getMessage());

But it doesn't work and doesn't have Exception,I don't know why? i use Phalcon 1.3

Please help me, Thanks!

It's solved!!! because the field created's type is time(),but I give datetime()


This would help:

if ($log->save() === false) {
    foreach ($log->getMessages() as $message) {
       echo $message->getMessage();


Thank you!

This would help:

```php if ($log->save() === false) { foreach ($log->getMessages() as $message) { echo $message->getMessage(); } } ```