src/Neutrino/Model.php
protected function timestampable($name, array $options = [])
    {
        if ((isset($options['autoInsert']) && $options['autoInsert']) ||
            (isset($options['autoUpdate']) && $options['autoUpdate'])
        ) {
            throw new \RuntimeException('Model: A timestampable field can\'t have autoInsert or autoUpdate.');
        }

        self::column($name, isset($options['type']) ? $options['type'] : Column::TYPE_DATETIME, $options);

        $params = [];

        if (!isset($options['default']) && isset($options['insert']) && $options['insert']) {
            $params['beforeValidationOnCreate'] = [
                'field'  => $name,
                'format' => isset($options['format']) ? $options['format'] : DATE_ATOM
            ];
        }

        if (isset($options['update']) && $options['update']) {
            $params['beforeValidationOnUpdate'] = [
                'field'  => $name,
                'format' => isset($options['format']) ? $options['format'] : DATE_ATOM
            ];
        }

        if(empty($params)){
            throw new \RuntimeException('Model: A timestampable field needs to have at least insert or update.');
        }

        $this->addBehavior(new Timestampable($params));
    }
protected function timestampable($name, array $options = [])
    {
        if ((isset($options['autoInsert']) && $options['autoInsert']) ||
            (isset($options['autoUpdate']) && $options['autoUpdate'])
        ) {
            throw new \RuntimeException('Model: A timestampable field can\'t have autoInsert or autoUpdate.');
        }

        self::column($name, isset($options['type']) ? $options['type'] : Column::TYPE_DATETIME, $options);

        $params = [];

        if (!isset($options['default']) && isset($options['insert']) && $options['insert']) {
            $params['beforeValidationOnCreate'] = [
                'field'  => $name,
                'format' => isset($options['format']) ? $options['format'] : DATE_ATOM
            ];
        }

        if (isset($options['update']) && $options['update']) {
            $params['beforeValidationOnUpdate'] = [
                'field'  => $name,
                'format' => isset($options['format']) ? $options['format'] : DATE_ATOM
            ];
        }

        if(empty($params)){
            throw new \RuntimeException('Model: A timestampable field needs to have at least insert or update.');
        }

        $this->addBehavior(new Timestampable($params));
    }
Define a timestampable column.
Automatically add the Timestampable behavior.

@param string $name
@param array  $options