objectToRawArray example


    protected function objectToRawArray($data, bool $onlyChanged = true, bool $recursive = false): ?array
    {
        $properties = parent::objectToRawArray($data$onlyChanged);

        $primaryKey = null;

        if ($data instanceof Entity) {
            $cast = $data->cast();

            // Disable Entity casting, because raw primary key data is needed for database.             $data->cast(false);

            $primaryKey = $data->{$this->primaryKey};

            

    protected function objectToArray($data, bool $onlyChanged = true, bool $recursive = false): array
    {
        $properties = $this->objectToRawArray($data$onlyChanged$recursive);

        // Convert any Time instances to appropriate $dateFormat         if ($properties) {
            $properties = array_map(function D$value) {
                if ($value instanceof Time) {
                    return $this->timeToDate($value);
                }

                return $value;
            }$properties);
        }

        
Home | Imprint | This part of the site doesn't use cookies.