Hey everyone,

During migrating an application using Symfony3 with Doctrine between 
platforms, I encountered a problem with boolean type stored in database 
without native boolean type support (target RDBMS is Oracle database). 

In entity I use basic construction for booleans:

class foo{
    /**
     * @ORM\Column(type="boolean")
     */
    protected $isActive = true;

In controller:

$foo->setIsActive(TRUE);// PHP7 converts to 1 and works fine. From data 
base is retrieved as TRUE PHP boolean type
$em->flush();

$foo->setIsActive(FALSE);// PHP7 converts to empty string (""). Oracle 
interpretes it as NULL and will insert NULL value - throw error "NULL value 
not allowed" in above case.
$em->flush();

$foo->setIsActive(0); // Oracle will insert 0 and works fine. From data 
base is retrieved as FALSE PHP boolean type. In application side I don't 
have real boolean type, so comparison with === will be impossible if needed.
$em->flush();


Just allowing nulls is not an good solution in that case. In situation when 
i need 3 statuses (Data not set - NULL, TRUE and FALSE) I simply can not 
distinguish if user did not set data yet or set it to FALSE.

Do someone have any idea how to bypass this problem?

Thanks

Leszek











-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to