pushrbx icon

Untitled

pushrbx | PRO | 03/20/14 02:04:31 PM UTC | 0 ⭐ | 393 👁️ | Never ⏰ | []
PHP |

1.31 KB

|

None

|

0 👍

/

0 👎

$this->Node->saveAll(array(
    0 => array(
        'Node' => array(
            'id' => '61348',
            'title' => 'Acceloid Team',
            'slug' => 'acceloid-team',
            'user_id' => (int) 1,
            'type' => 'csapat',
            'status' => (int) 1,
            'scope' => (int) 1,
            'path' => '/team/acceloid-team',
            'visibility_roles' => ''
        ),
        'Team' => array(
            'node_id' => '61348',
            'id' => '1',
            'state' => 'active',
            'email' => '[email protected]',
            'link' => 'N/A',
            'formed' => '2013-08-02',
            'image' => 'images/teams/673.jpg',
            'is_verified' => 0,
            'Project' => array(
                0 => array(
                    'node_id' => '61357',
                    'progress' => '0',
                    'special_count' => 0,
                    'state' => 'hidden',
                    'params' => '{}',
                    'modified' => '2014-03-20 14:52:53'
                )
            )
        )
    )
), array('deep' => true));
 
// Models:
class Team extends AppModel
{
    public $hasAndBelongsToMany = array(
        'Project' => array(
            'className' => 'Project',
            'joinTable' => 'teams_projects',
            'foreignKey' => 'team_id',
            'associationForeignKey' => 'project_id',
        )
    );
}
 
class Project extends AppModel
{
    public $hasAndBelongsToMany = array(
        'Team' => array(
            'className' => 'Team',
            'joinTable' => 'teams_projects',
            'foreignKey' => 'project_id',
            'associationForeignKey' => 'team_id',
        )
    );
}

Comments