Doctrine 条令中是否有isnull或ifnull函数?

Doctrine 条令中是否有isnull或ifnull函数?,doctrine,doctrine-orm,isnull,Doctrine,Doctrine Orm,Isnull,我正在寻找一个将空值转换为指定默认值的函数。所以IsNull(A,B)应该返回B,如果A为null,则返回A。Dority有这样的功能吗?如果要从对象中获取空值,请在实体中编写一个方法 <?php // Entities/SomeEntity.php class Foo { private $a; private $b; // ... // Your getters and setters are here // ... publi

我正在寻找一个将空值转换为指定默认值的函数。所以IsNull(A,B)应该返回B,如果A为null,则返回A。Dority有这样的功能吗?

如果要从对象中获取空值,请在实体中编写一个方法

<?php
// Entities/SomeEntity.php

class Foo
{
    private $a;

    private $b;

    // ...
    // Your getters and setters are here
    // ... 

    public function myNullFunction()
    {
       if($this->a === null AND $this->b !== null)
       {
           return $this->b;
       }
       elseif($this->b === null && $this->a !== null)
       {
           return $this->a;
       }
       else
       {
          // ... Do something if both are null
       }
    }
}

如果您正在谈论从对象获取空值,请在实体中编写一个方法

<?php
// Entities/SomeEntity.php

class Foo
{
    private $a;

    private $b;

    // ...
    // Your getters and setters are here
    // ... 

    public function myNullFunction()
    {
       if($this->a === null AND $this->b !== null)
       {
           return $this->b;
       }
       elseif($this->b === null && $this->a !== null)
       {
           return $this->a;
       }
       else
       {
          // ... Do something if both are null
       }
    }
}

您可以使用以下项目,该项目包含一些MSSQL函数:

您可以使用以下项目,该项目包含一些MSSQL函数:

你为什么不自己写呢?你为什么不自己写呢?