本文整理汇总了PHP中Mapper类的典型用法代码示例。如果您正苦于以下问题:PHP Mapper类的具体用法?PHP Mapper怎么用?PHP Mapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testEmptyElementIfIsReference
public function testEmptyElementIfIsReference()
{
$m = new Mapper($this->project);
$m->setFrom("*.java");
try {
$m->setRefid(new Reference("dummyref"));
$this->fail("Can add reference to Mapper with from attribute set");
} catch (BuildException $be) {
$this->assertEquals("You must not specify more than one attribute when using refid", $be->getMessage());
}
$m = new Mapper($this->project);
$m->setRefid(new Reference("dummyref"));
try {
$m->setFrom("*.java");
$this->fail("Can set from in Mapper that is a reference.");
} catch (BuildException $be) {
$this->assertEquals("You must not specify more than one attribute when using refid", $be->getMessage());
}
$m = new Mapper($this->project);
$m->setRefid(new Reference("dummyref"));
try {
$m->setTo("*.java");
$this->fail("Can set to in Mapper that is a reference.");
} catch (BuildException $be) {
$this->assertEquals("You must not specify more than one attribute when using refid", $be->getMessage());
}
try {
$m = new Mapper($this->project);
$m->setRefid(new Reference("dummyref"));
$m->setType("glob");
$this->fail("Can set type in Mapper that is a reference.");
} catch (BuildException $be) {
$this->assertEquals("You must not specify more than one attribute when using refid", $be->getMessage());
}
}
开发者ID:umesecke,项目名称:phing,代码行数:35,代码来源:MapperTest.php
示例2: __construct
public function __construct(Mapper $mapper, array $namespaces, array $paths)
{
$this->mapper = $mapper;
$this->namespaces = $namespaces;
$this->paths = $paths;
$this->tables = $this->mapper->generate();
}
开发者ID:block8,项目名称:database,代码行数:7,代码来源:CodeGenerator.php
示例3: testMapperWithDefaultValue
public function testMapperWithDefaultValue()
{
require_once __DIR__ . '/helpers/MapperTestDefaultHelper.php';
$mapper = new Mapper();
$class = $mapper->mapInputToCommand('MapperTestDefaultHelper', []);
$this->assertEquals('456', $class->test);
}
开发者ID:jildertmiedema,项目名称:commander,代码行数:7,代码来源:MapperTest.php
示例4: login
function login()
{
if (!empty($_POST)) {
$check = new Check();
$user = new User();
$pdo = new Db();
$db = $pdo->get();
$mapper = new Mapper($db);
//Проверяем входные данные
$user->login = $check->checkInput($_POST['login']);
$password = $check->checkInput($_POST['pass']);
$user->password = md5($password);
//Если пользователь не найден
$this->user = $mapper->select($user);
if (empty($this->user)) {
$this->error = "Пароль или логин не совпадают";
$this->out('login.php');
} else {
$this->out('profile.php');
//Если найден, выводим профиль
}
} else {
$this->out('login.php');
}
}
开发者ID:toppestkek,项目名称:Test,代码行数:25,代码来源:ctrlIndex.php
示例5: add
/**
* Add file in given feed
* @return bool
*/
public static function add($feedID, $files, $ssh_connection)
{
// set permissions with the ssh connection
// get feed path
$mapper = new Mapper('Feed');
$mapper->get($feedID);
$resultsFeed = $mapper->get();
$mapper = new Mapper('User');
$mapper->get($resultsFeed['Feed'][0]->user_id);
$resultsUser = $mapper->get();
// target directory
$dir = CHRIS_USERS . '/' . $resultsUser['User'][0]->username . '/file_browser/' . $resultsFeed['Feed'][0]->name . '-' . $resultsFeed['Feed'][0]->id . '/';
$ssh_connection->exec('chmod 777 ' . $dir);
foreach ($files as $key => $value) {
$target_path = $dir . basename($value['name']);
if (move_uploaded_file($value['tmp_name'], $target_path)) {
// all good, set permissions correctly
// not through ssh connection, do it as chris
exec('chmod 775 ' . $target_path);
} else {
// oops.... something went wrong
return $value['error'];
}
$ssh_connection->exec('chmod 755 ' . $dir);
}
// all files uploaded successfully
return 0;
}
开发者ID:masroore,项目名称:chrisreloaded,代码行数:32,代码来源:file.controller.php
示例6: __construct
/**
* Constructor Method
*
* @param \Spot\Mapper $mapper
* @throws Exception
* @internal param $Spot_Mapper
* @internal param string $entityName Name of the entity to query on/for
*/
public function __construct(Mapper $mapper)
{
$this->_mapper = $mapper;
$this->_entityName = $mapper->entity();
$this->_tableName = $mapper->table();
// Create Doctrine DBAL query builder from Doctrine\DBAL\Connection
$this->_queryBuilder = $mapper->connection()->createQueryBuilder();
}
开发者ID:surjit,项目名称:spot2,代码行数:16,代码来源:Query.php
示例7: add
/**
* Add a <code>FileNameMapper</code>.
* @param FileNameMapper $fileNameMapper a <code>FileNameMapper</code>.
* @throws BadMethodCallException if attempting to add this
* <code>ContainerMapper</code> to itself, or if the specified
* <code>FileNameMapper</code> is itself a <code>ContainerMapper</code>
* that contains this <code>ContainerMapper</code>.
*/
public function add(Mapper $fileNameMapper)
{
if ($this == $fileNameMapper || $fileNameMapper instanceof ContainerMapper && $fileNameMapper->contains($this)) {
throw new BadMethodCallException("Circular mapper containment condition detected");
} else {
$this->mappers[] = $fileNameMapper;
}
}
开发者ID:Ingewikkeld,项目名称:phing,代码行数:16,代码来源:ContainerMapper.php
示例8: savelike
function savelike($like, $itemid)
{
$pdo = new Db();
$db = $pdo->get();
$mapper = new Mapper($db);
$comments = new Comments();
$comments->likes = $like;
$comments->id = $itemid;
$mapper->saveLike($comments);
}
开发者ID:toppestkek,项目名称:GuestBook,代码行数:10,代码来源:index.php
示例9: validate
/**
* Validate a token. Returns the result and deletes the token if valid.
*
* @param string $token The token
* @return boolean
*/
public static function validate($token)
{
$tokenMapper = new Mapper('Token');
$tokenMapper->filter('value=(?)', $token);
$tokenResults = $tokenMapper->get();
if (count($tokenResults['Token']) == 0) {
return false;
}
// we found the token
Mapper::delete($tokenResults['Token'][0], $tokenResults['Token'][0]->id);
return true;
}
开发者ID:masroore,项目名称:chrisreloaded,代码行数:18,代码来源:token.controller.php
示例10: writeOptionsFromObject
/**
* FormTools::WriteOptionsFromObject()
* Prend en paramètres un nom d'objet et retourne un tableau
* d'options de type:
* <code>
* [0=>'<option value="1">Label1</option>',
* 1=>'<option value="2">Label2</option>']
* </code>
*
* @static
* @param string $objname le nom de l'objet
* @param mixed $selID la ou les valeurs selectionnées par défaut
* @param mixed array or Filter: un filtre optionnel à appliquer
* @param array $sort un tableau optionnel pour le tri
* @param string $labelMethod la méthode à utiliser pour le label
* @param array $fields les attributs à récupérer.
* @param boolean $addNullEntry true pour ajouter une option 'Sélectionnez
* un élément'
* @return array the options array
*/
static function writeOptionsFromObject($objname, $selID = 0, $filter = array(), $sort = array(), $labelmethod = 'toString', $fields = array(), $addNullEntry = false)
{
$options = array();
$mapper = Mapper::singleton($objname);
if (Tools::isException($mapper)) {
return $mapper;
}
if ($labelmethod == 'toString') {
$toStringAttribute = Tools::getToStringAttribute($objname);
$fields = is_array($toStringAttribute) ? $toStringAttribute : array($toStringAttribute);
}
$col = $mapper->loadCollection($filter, $sort, $fields);
if ($col instanceof Collection) {
$dataArray = array();
$count = $col->getCount();
for ($i = 0; $i < $count; $i++) {
$item = $col->getItem($i);
if (method_exists($item, 'getId') && method_exists($item, $labelmethod)) {
$dataArray[$item->getId()] = $item->{$labelmethod}();
}
unset($item);
}
$options = FormTools::writeOptionsFromArray($dataArray, $selID, $addNullEntry);
}
return $options;
}
开发者ID:arhe,项目名称:pwak,代码行数:46,代码来源:Form.php
示例11: write
public static function write($name, $value, $expires = null)
{
$self = self::getInstance();
$expires = $self->expire($expires);
$path = Mapper::normalize(Mapper::base() . $self->path);
return setcookie($self->name . '[' . $name . ']', self::encrypt($value), $expires, $path, $self->domain, $self->secure);
}
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:7,代码来源:Cookie.php
示例12: verifySettings
/**
* Checks to make sure all settings are kosher. In this case, it
* means that the dest attribute has been set and we have a mapper.
*/
public function verifySettings()
{
if ($this->targetdir === null) {
$this->setError("The targetdir attribute is required.");
}
if ($this->map === null) {
if ($this->mapperElement === null) {
$this->map = new IdentityMapper();
} else {
$this->map = $this->mapperElement->getImplementation();
if ($this->map === null) {
$this->setError("Could not set <mapper> element.");
}
}
}
}
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:20,代码来源:MappingSelector.php
示例13: link
public function link($text, $url = null, $attr = array(), $full = false)
{
if (is_null($url)) {
$url = $text;
}
$attr['href'] = Mapper::url($url, $full);
return $this->tag('a', $text, $attr);
}
开发者ID:klawdyo,项目名称:spaghetti-lib,代码行数:8,代码来源:HtmlHelper.php
示例14: __construct
/**
* ActivityMapper constructor.
*/
public function __construct()
{
parent::__construct();
$this->selectAll = self::$db_handler->prepare('SELECT title, content FROM activity');
$this->selectStmt = self::$db_handler->prepare('SELECT * FROM activity WHERE acid=?');
$this->updateStmt = self::$db_handler->prepare('UPDATE activity SET title=?, content=?, a_img_url=?, enter_amount=?, end_time=? WHERE acid=?');
$this->insertStmt = self::$db_handler->prepare('INSERT INTO activity ( title, content, post_time, end_time ) VALUES( ?, ?, ?, ? )');
}
开发者ID:570468837,项目名称:Daily-pracitce,代码行数:11,代码来源:ActivityMapper.php
示例15: __construct
/**
* PostMapper constructor.
*/
public function __construct()
{
parent::__construct();
$this->selectAll = self::$db_handler->prepare('SELECT * FROM post ORDER BY post_id');
$this->selectStmt = self::$db_handler->prepare('SELECT * FROM post WHERE post_id=?');
$this->updateStmt = self::$db_handler->prepare('UPDATE post SET content=? WHERE post_id=?');
$this->insertStmt = self::$db_handler->prepare('INSERT INTO post (content, post_time) VALUES(?, ? )');
}
开发者ID:570468837,项目名称:Daily-pracitce,代码行数:11,代码来源:PostMapper.php
示例16: create
public function create($action = null, $options = array())
{
$options += array('method' => 'post', 'action' => Mapper::url($action));
if ($options['method'] == 'file') {
$options['method'] = 'post';
$options['enctype'] = 'multipart/form-data';
}
return $this->html->openTag('form', $options);
}
开发者ID:spaghettiphp,项目名称:spaghettiphp,代码行数:9,代码来源:FormHelper.php
示例17: getComputed
/**
* Returns lazy loaded field by its name
*
* @param string $fieldName
* @return mixed
*/
public function getComputed($fieldName)
{
if (!isset($this->computed[$fieldName])) {
$value = $this->mapper->lazyload($this, $fieldName);
$this->computed[$fieldName] = $value;
}
return $this->computed[$fieldName];
}
开发者ID:emoveo,项目名称:sfm,代码行数:14,代码来源:Business.php
示例18: registerAdapter
public function registerAdapter($name, Adapter $adapter)
{
if (isset($this->adapters[$name])) {
throw new Exception\InvalidArgumentException("Adapter with name " . $name . " already registered!");
}
$this->adapters[$name] = $adapter;
if ($adapter->getMapping()) {
$this->mapper->registerAdapterMapping($name, $adapter->getMapping());
}
}
开发者ID:bauer01,项目名称:unimapper,代码行数:10,代码来源:Connection.php
示例19: get
public function get(array $hashMap, $isNestedKeysName = false)
{
$pattern = $this->getPattern($isNestedKeysName);
$this->mapper->match($pattern, [$hashMap]);
$data = $this->mapper->current();
if (empty($data)) {
$result = $this->getEmptyArray($pattern);
} else {
$result = $this->arrayHelper->toTuple($data, $pattern);
}
return $result;
}
开发者ID:angrybender,项目名称:phpPM,代码行数:12,代码来源:Assign.php
示例20: __construct
public function __construct()
{
parent::__construct();
$this->selectStmt = self::$db_handler->prepare('SELECT * FROM role WHERE rid=?');
$this->updateStmt = self::$db_handler->prepare('UPDATE role SET role=?, role_des=? WHERE rid=?');
$this->insertStmt = self::$db_handler->prepare('INSERT INTO role ( role, role_des ) VALUES( ?, ? )');
}
开发者ID:570468837,项目名称:Daily-pracitce,代码行数:7,代码来源:RoleMapper.php
注:本文中的Mapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论