Author

class Nos\Orm_Behaviour_Author

Keeps track of who created an item and who updated it. Great to use in combination of Observer_CreatedAt and Observer_UpdatedAt.

Configuration

property Nos\Orm_Behaviour_Author::$created_by_property

Column used to store the user ID when the item is created. Its data type must be unsigned int.

property Nos\Orm_Behaviour_Author::$updated_by_property

Column used to store the user ID when the item is updated (also used upon creation). Its data type must be unsigned int.

Example

<?php

class Model_Page extends \Nos\Orm\Model
{
    protected static $_properties = array(
        // ...
        'page_created_by_id' => array(
            'default' => null,
            'data_type' => 'int unsigned',
            'null' => true,
            'convert_empty_to_null' => true,
        ),
        'page_updated_by_id' => array(
            'default' => null,
            'data_type' => 'int unsigned',
            'null' => true,
            'convert_empty_to_null' => true,
        ),
    );

    protected static $_behaviours = array(
        'Nos\Orm_Behaviour_Author' => array(
            'created_by_property' => 'page_created_by_id',
            'updated_by_property' => 'page_updated_by_id',
        ),
    );
}
Read the Docs v: elche
Versions
latest
stable
elche
dubrovka
chiba.2
chiba.1
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.