Adldap\Models\Model::getModifications PHP Method

getModifications() public method

Sets and returns the models modifications.
public getModifications ( ) : array
return array
    public function getModifications()
    {
        foreach ($this->getDirty() as $attribute => $values) {
            // Make sure values is always an array.
            $values = is_array($values) ? $values : [$values];
            // Create a new modification.
            $modification = new BatchModification($attribute, null, $values);
            if (array_key_exists($attribute, $this->original)) {
                // If the attribute we're modifying has an original value, we'll give the
                // BatchModification object its values to automatically determine
                // which type of LDAP operation we need to perform.
                $modification->setOriginal($this->original[$attribute]);
            }
            // Finally, we'll add the modification to the model.
            $this->addModification($modification->build());
        }
        return $this->modifications;
    }