zoukankan      html  css  js  c++  java
  • cake模型笔记

    RelationshipAssociation TypeExample
    one to one hasOne A user has one profile.
    one to many hasMany A user can have multiple recipes.
    many to one belongsTo Many recipes belong to a user.
    many to many hasAndBelongsToMany Recipes have, and belong to many ingredients.

    四种关联关系。

    一个例子

        /**
         * hasOne associations
         *
         * @var array
         */
        public $hasOne = array(
            'Engine' => array(
                'className' => 'Engine',
                'foreignKey' => 'user_id',
                'conditions' => '',
                'fields' => '',
                'order' => ''
            ),
            'TbAppkey' => array(
                'className' => 'TbAppkey',
                'foreignKey' => 'user_id',
                'conditions' => '',
                'fields' => '',
                'order' => ''
            ),
            'UserAccount' => array(
                'className' => 'UserAccount',
                'foreignKey' => 'user_id',
                'conditions' => '',
                'fields' => '',
                'order' => ''
            )
        );
    
        /**
         * belongsTo associations
         *
         * @var array
         */
        public $belongsTo = array(
            'UserGroup' => array(
                'className' => 'UserGroup',
                'foreignKey' => 'user_group_id',
                'conditions' => '',
                'fields' => '',
                'order' => '',
                'type' => 'inner'
            ),
            'Domain' => array(
                'className' => 'Engine',
                'foreignKey' => 'domain_id',
                'dependent' => false,
                'conditions' => '',
                'fields' => '',
                'order' => '',
                'limit' => '',
                'offset' => '',
                'exclusive' => '',
                'finderQuery' => '',
                'counterQuery' => '',
                'type' => 'inner'
            )
        );
    
        /**
         * hasMany associations
         *
         * @var array
         */
        public $hasMany = array(
            'Merchant' => array(
                'className' => 'Merchant',
                'foreignKey' => 'user_id',
                'dependent' => false,
                'conditions' => '',
                'fields' => '',
                'order' => '',
                'limit' => '',
                'offset' => '',
                'exclusive' => '',
                'finderQuery' => '',
                'counterQuery' => ''
            ),
            'UserAccessPlatform' => array(
                'className' => 'UserAccessPlatform',
                'foreignKey' => 'user_id',
                'dependent' => false,
                'conditions' => '',
                'fields' => '',
                'order' => '',
                'limit' => '',
                'offset' => '',
                'exclusive' => '',
                'finderQuery' => '',
                'counterQuery' => ''
            )
        );
  • 相关阅读:
    Displaying XML in a Swing JTree
    jdom解析xml
    How to display XML in a JTree using JDOM
    关于XML文档和JAVA中的JTree之间如何转换的问题
    java swing 学习
    硅谷创业教父Paul Graham:如何获得创业idea
    如何成为一位优秀的创业CEO
    硅谷归来7点分享:创业者,做你自己
    The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 C Buy Watermelon
    The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 B so easy
  • 原文地址:https://www.cnblogs.com/linksgo2011/p/2988712.html
Copyright © 2011-2022 走看看