本文整理汇总了PHP中isNull函数的典型用法代码示例。如果您正苦于以下问题:PHP isNull函数的具体用法?PHP isNull怎么用?PHP isNull使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isNull函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadById
public function loadById($id)
{
if (isNull($object = $this->_mapper->storage()->loadObjectById($id))) {
return $this->_mapper->getDefaultGroup();
}
return $object;
}
示例2: transfer
function transfer()
{
$query = M('Db')->createQuery('tmp_equipment_export')->what('city_id, user_id, scaner_id, modem_id, laptop_id')->where('`exit` IS NULL OR `exit` = ""');
$request = M('Store')->requestQuery(M('Store')->factoryObject(), $query);
$transfer = 0;
foreach ($request as $object) {
if (!isNull($obHolder = getHolderByUserId($object->user_id))) {
if (!isNull($obEquipment = M('Equipment')->loadById($object->scaner_id))) {
if ($obEquipment->holder_id != $obHolder->id) {
$obEquipment->setHolder($obHolder);
$obEquipment->save();
$transfer++;
}
}
if (!isNull($obEquipment = M('Equipment')->loadById($object->modem_id))) {
if ($obEquipment->holder_id != $obHolder->id) {
$obEquipment->setHolder($obHolder);
$obEquipment->save();
$transfer++;
}
}
if (!isNull($obEquipment = M('Equipment')->loadById($object->laptop_id))) {
if ($obEquipment->holder_id != $obHolder->id) {
$obEquipment->setHolder($obHolder);
$obEquipment->save();
$transfer++;
}
}
}
}
echo "\n\nTRANSFER: {$transfer} enities";
}
示例3: _list
protected function _list()
{
if (isNull($this->_list)) {
$this->_list = M('List')->loadById($this->_list_id);
}
return $this->_list;
}
示例4: me
/**
* Returns logged user or anonymous user.
*
* @return RM_Account_iUser
*/
function me()
{
if (isNull($result = M('Account')->getLoggedUser())) {
$result = M('Account')->getAnonymousUser();
}
return $result;
}
示例5: _isAddToModeration
protected function _isAddToModeration()
{
$barcode = $this->_object->getBarcode();
if (!M('Purchase')->isInStopList($this->_object->barcode_value) && (isNull($barcode = $this->_object->getBarcode()) || $barcode->attribute_1 != $this->_object->corrected_name)) {
return TRUE;
}
}
示例6: depth
function depth($input_data, $path = null, $depth = 0)
{
/*
Returns the depth of the node that reaches the input data instance
when ran through the tree, and the associated set of rules.
If a node has any children whose
predicates are all true given the instance, then the instance will
flow through that child. If the node has no children or no
children with all valid predicates, then it outputs the depth of the
node.
*/
if (isNull($path)) {
$path = array();
}
# root node: if predicates are met, depth becomes 1, otherwise is 0
if ($depth == 0) {
if (!$this->predicates->apply($input_data, $this->fields)) {
return array($depth, $path);
}
$depth += 1;
}
if ($this->children != null) {
foreach ($this->children as $child) {
if ($child->predicates->apply($input_data, $this->fields)) {
$array_push($path, $child->predicates->to_rule($this->fields));
return $child->depth($input_data, $path, $depth + 1);
}
}
}
return array($depth, $path);
}
示例7: loadCategoryByName
public function loadCategoryByName($name)
{
if (!isNull($object = $this->_mapper->loadCategoryByName($name))) {
$this->_mapper->access($object, 'CATEGORY.USE');
}
return $object;
}
示例8: getCaptionByVarname
public function getCaptionByVarname($name)
{
if (!isNull($value = $this->loadObjectByName($name))) {
return $value->getCaption();
}
return L('list.value.' . $name);
}
示例9: loadReportById
/**
* Description...
*
* @return void
**/
public function loadReportById($id)
{
if (!isNull($object = $this->_mapper->storage('total')->loadObjectById($id))) {
$this->_mapper->access($object, 'READ');
}
return $object;
}
示例10: get
/**
* Enter description here...
*
* @return RM_Diagram_Object
*/
protected function get()
{
if (!$this->_diagram && isNull($this->_diagram = M('Diagram')->loadDiagramByName($this->_name))) {
$this->create();
}
return $this->_diagram;
}
示例11: getDiagramList
public function getDiagramList()
{
$obData = $this->getData();
$obData->setColumnsForRowDescribe();
$obData->hideColumns(REPDATA_ALL);
$obData->setSharedParams($this->_object->detail()->getFieldNameWithName());
$diagrams = array();
foreach ($this->_object->getValues() as $obValue) {
if (isNull($obDiagram = M('Diagram')->loadDiagramByName($this->getDiagramName($obValue)))) {
$obData->hideColumns(REPDATA_ALL);
$obData->showColumns($obValue->getVarname());
$obDiagram = $this->advancedKpiStrategy()->createDiagramByData($obData, $obValue);
$obDiagram->setPermissionLikeObject($this->_object);
$obDiagram->rowCaptionVariable($this->_object->detail()->getFieldNameWithName());
$obDiagram->yLabelsCallbackFunction(array($obValue, 'callbackForPlotAxis'));
$obDiagram->xLabelsCallbackFunction(array($this->_object->period(), 'getCaptionBySystemValue'));
$obDiagram->prepareFunction(array($obValue, 'callbackForPlot'));
$obDiagram->setAxisCaption(array($obValue, 'getAxisCaption'));
$obDiagram->draw();
$obDiagram->save();
}
$diagrams[] = $obDiagram;
}
return $diagrams;
}
示例12: getUserString
public function getUserString($obUser, $description = 'user')
{
$add_str = " (";
$add_str .= !isNull($obUser->getCity()) ? $obUser->getCity()->name : "Unknown City";
$add_str .= ")";
return $description . "=" . $obUser->id() . " " . $obUser->getAddressTo() . $add_str;
}
示例13: installTemplateType
/**
* install template type
* @param string name : template type name
* @param string description : description for template type
* @param array variables : type variables with description
* Example:
* array(
* "nick" => "User nick",
* "email" => "User email (use as login)",
* "password" => "User password",
* "login" => "User login",
* );
* @param array templates : array of templates params
* Example:
* $ar = array();
*
* $ar[] = array(
* "lang" => "rus",
* "file_path" => "/rus/user/",
* "file_name" => "new.php",
* );
*
* $ar[] = array(
* "lang" => "eng",
* "file_path" => "/eng/user/",
* "file_name" => "new.php",
* );
*
*
* @return void
*/
function installTemplateType($name, $description, array $variables, array $templates)
{
if (!isNull($obType = M("MailTemplate")->loadTypeById($name))) {
$obType->delete();
}
$obType = M("MailTemplate")->createType($name);
$obType->description = $description;
$obType->save();
if (!isNull($obType)) {
foreach ($variables as $k => $v) {
// create variable object
$ob = $obType->createVariable($k);
// init variable properties
$ob->description = $v;
// save variable
if (!$ob->save()) {
print_r($ob->validator()->getErrors());
}
}
}
if (!isNull($obType)) {
foreach ($templates as $v) {
// create template object
$ob = $obType->createTemplate();
// init template object properties
foreach ($v as $k => $s) {
$ob->{$k} = $s;
}
// save template object
if (!$ob->save()) {
print_r($ob->validator()->getErrors());
}
}
}
}
示例14: getInstance
public static function getInstance()
{
if (isNull(static::$instance)) {
static::$instance = new static();
}
return static::$instance;
}
示例15: validateContainerName
protected function validateContainerName($container)
{
if (isNull($this->helper)) {
$this->helper = new ContainerHelper();
}
return $this->helper->containerExists($container);
}