Classes

File mvc/model/MappingModelField.class.php

File mvc/model/MappingModelField.class.php

 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 
<?php
/**
 * @package     MVC
 * @subpackage  Model
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Loic ROUCHON <horn@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2014 12 22
 * @since       PHPBoost 3.0 - 2009 10 02
*/

class MappingModelField
{
    const DEFAULT_PROPERTY_NAME = 0x01;
    const GETTER_PREFIX = 'get_';
    const SETTER_PREFIX = 'set_';

    /**
     * @var string
     */
    private $db_field_name;

    /**
     * @var string
     */
    private $property_name;

    /**
     * @var string
     */
    private $getter;

    /**
     * @var string
     */
    private $setter;

    public function __construct($property_name, $db_field_name = self::DEFAULT_PROPERTY_NAME)
    {
        $this->property_name = $property_name;
        if ($db_field_name !== self::DEFAULT_PROPERTY_NAME)
        {
            $this->db_field_name = $db_field_name;
        }
        else
        {
            $this->db_field_name = $this->property_name;
        }

        $this->getter = self::GETTER_PREFIX . $property_name;
        $this->setter = self::SETTER_PREFIX . $property_name;
    }

    /**
     * @return string
     */
    public function get_db_field_name()
    {
        return $this->db_field_name;
    }

    /**
     * @return string
     */
    public function get_property_name()
    {
        return $this->property_name;
    }

    /**
     * @return string
     */
    public function getter()
    {
        return $this->getter;
    }

    /**
     * @return string
     */
    public function setter()
    {
        return $this->setter;
    }
}
?>
Annonces