本文整理汇总了PHP中People::create方法的典型用法代码示例。如果您正苦于以下问题:PHP People::create方法的具体用法?PHP People::create怎么用?PHP People::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类People
的用法示例。
在下文中一共展示了People::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate
public function testCreate()
{
$this->_mock = new Mock_Database($this, array(array('execute', "INSERT INTO passports\nSET `col` = ?", array('val'), null, array('inserted_id' => 1)), array('execute', "INSERT INTO people\nSET `name` = ?, `passport_id` = ?", array('Name', 1), null, array('inserted_id' => 2))));
\Snowfire\Database\Model::database($this->_mock);
$people_model = new People();
$passports_model = new Passports();
$this->assertEquals(2, $people_model->create(array('name' => 'Name', 'passport' => array('col' => 'val')), array('passports' => $passports_model)));
}
示例2: foreach
*
* PHP version 5
*
* @category Core
* @package LeQG
* @author Damien Senger <hi@hiwelo.co>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
* @link http://leqg.info
*/
require_once 'includes.php';
$link = Configuration::read('db.link');
$query = $link->prepare('SELECT * FROM `TABLE 30` LIMIT 0, 50');
$query->execute();
$contacts = $query->fetchAll(PDO::FETCH_ASSOC);
foreach ($contacts as $contact) {
$person = People::create();
$person = new People($person);
Core::debug($contact, false);
// Traitement du nom
$person->update('nom', $contact['NOM']);
$person->update('prenoms', $contact['PRENOM']);
// On paramètre le sexe
$genre = trim($contact['GENRE']);
if ($genre == 'Madame') {
$person->update('sexe', 'F');
} else {
$person->update('sexe', 'H');
}
$adresse = array('pays' => 'France', 'ville' => '', 'zip' => '', 'street' => '', 'building' => '');
$decomposition_rue = explode(' ', $contact['ADRESSE 3']);
$numero = $decomposition_rue[0];
示例3: elseif
Core::goPage('contacts', true);
} else {
Core::goPage('services', true);
}
} else {
// Si on demande l'affichage du module contacts
if ($_GET['page'] == 'contacts') {
Core::loadTemplate('contacts');
} elseif ($_GET['page'] == 'contact') {
if (isset($_GET['contact'])) {
Core::loadTemplate('contact');
} elseif (isset($_GET['operation'])) {
// Si l'opération consiste en une création, on créé le contact ici
if ($_GET['operation'] == 'creation') {
// On va commencer par créer une nouvelle fiche et récupérer son identifiant
$id = People::create();
// On redirige vers la nouvelle fiche créée
Core::goPage('contact', array('contact' => $id), true);
} else {
Core::loadTemplate('contact', $_GET['operation']);
}
} else {
Core::goPage('contacts', true);
}
} elseif ($_GET['page'] == 'dossiers') {
Core::loadTemplate('dossiers');
} elseif ($_GET['page'] == 'dossier') {
if (isset($_GET['dossier'])) {
Core::loadTemplate('dossier');
} else {
Core::loadTemplate('dossiers');