. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ namespace Espo\ORM\Mapper; use Espo\ORM\Entity; use stdClass; /** * @since 10.0.0 * @internal */ class Util { /** * @internal */ public static function prepareValue(?string $type, mixed $value): mixed { if ($type == Entity::JSON_ARRAY && is_array($value)) { $value = json_encode($value, JSON_UNESCAPED_UNICODE); } else if ($type == Entity::JSON_OBJECT && (is_array($value) || $value instanceof stdClass)) { $value = json_encode($value, JSON_UNESCAPED_UNICODE); } else { if (is_array($value) || is_object($value)) { return null; } } return $value; } }