DirectoryTree / LdapRecord

A fully-featured LDAP framework.
https://ldaprecord.com
MIT License
500 stars 44 forks source link

Bug 707 - Attribute casting seem to work only in one direction #712

Closed stevebauman closed 4 months ago

stevebauman commented 4 months ago

Closes #707

This PR implements reverse casting that previously did not exist, as discovered by @lukasmu.

This means that attributes on LDAP models can now be set to primitives, such as booleans:

$user = User::findOrFail('...');

$user->msExchHideFromAddressList = true;

// ['TRUE']
var_dump($user->getRawAttribute('msExchHideFromAddressList'));

And objects, such as dates:

$user = User::findOrFail('...');

$user->accountExpires = new \DateTime('2020-10-02 02:22:09');

// ['132460789290000000']
var_dump($user->getRawAttribute('accountExpires'));