本文整理汇总了PHP中Crud::addSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP Crud::addSubject方法的具体用法?PHP Crud::addSubject怎么用?PHP Crud::addSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crud
的用法示例。
在下文中一共展示了Crud::addSubject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCrud
public function testCrud()
{
$c = new Crud();
$c->addSubject(array('data' => array(array('id' => '123', 'title' => 'shirt', 'images' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png'), 'thumbnails' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png')))));
$r = $this->engine->upload($c);
$this->assertEquals($r->status, 200);
$r = $this->engine->update($c);
$this->assertEquals($r->status, 200);
$r = $this->engine->delete($c);
$this->assertEquals($r->status, 200);
}
示例2: MerlinCrud
<?php
namespace Merlin;
require_once '../Merlin/Merlin.php';
//creates an instance of the Merlin crud engine
$crud = new MerlinCrud('blackbird', 'dev', 'guest_dev', 'c73c11c411b449e6a16755efd219cf18', 'guest@blackbird.am');
// creates a Crud parameter and adds a subject
$c = new Crud();
$c->addSubject(array('data' => array(array('id' => '123', 'title' => 'shirt', 'images' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png'), 'thumbnails' => array('https://upload.wikimedia.org/wikipedia/commons/8/8c/Polo_Shirt_Basic_Pattern.png')))));
//uploads the subject
$r = $crud->upload($c);
var_dump($r);
// create the same subject but change the title
$c = new Crud();
$c->addSubject(array('data' => array(array('id' => '123', 'title' => 'plain shirt'))));
// update the subject
$r = $crud->update($c);
var_dump($r);
//delete the subject
$r = $crud->delete($c);
var_dump($r);