Virtualpath

class Nos\Orm_Behaviour_Virtualpath
Adds a virtual path to an item.

See also

Nos\Orm_Behaviour_Virtualname for configuration and methods.

Configuration

property Nos\Orm_Behaviour_Virtualpath::$virtual_path_property

Required. Column name use for save virtual path.

property Nos\Orm_Behaviour_Virtualpath::$extension_property

Required. If it’s a string, it will be appended to the virtual path. If it’s an array:

before:String to add to extension start.
after:String to add to extension end.
property:Column name used to store the extension.
property Nos\Orm_Behaviour_Virtualpath::$extension_property

Required. Name of the parent relation use to generate the first part of the virtual path.

Methods

Nos\Orm_Behaviour_Virtualpath::virtual_path($dir = false)
Parameters:
  • $dir (boolean) – If true, extension is replaced by a final /.
Returns:

Virtual path of the item.

Nos\Orm_Behaviour_Virtualpath::extension()
Returns:Return extension part of the virtual path.

Example

<?php
class Model_Page extends \Nos\Orm\Model
{
        protected static $_behaviours = array(
                'Nos\Orm_Behaviour_Virtualpath' => array(
                        'events' => array('before_save', 'after_save', 'change_parent'),
                        'virtual_name_property' => 'page_virtual_name',
                        'virtual_path_property' => 'page_virtual_url',
                        'extension_property' => '.html',
                        'parent_relation' => 'parent',
                ),
        );
}