How to bypass error "Invalid type "json_array""

I have an entity:

<?php

namespace AppEntityAero;

use DoctrineORMMapping as ORM;

/**
 * @ORMEntity(repositoryClass="AppRepositoryAeroScheduleRepository")
 */
class Schedule
{
    /**
     * @ORMId()
     * @ORMGeneratedValue()
     * @ORMColumn(type="integer")
     */
    private $id;

    /**
     * @ORMColumn(type="date")
     */
    private $dateOfFlight;

    /**
     * @ORMColumn(type="json")
     */
    private $timeOfFlightAndStations = [];

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getDateOfFlight(): ?DateTimeInterface
    {
        return $this->dateOfFlight;
    }

    public function setDateOfFlight(DateTimeInterface $dateOfFlight): self
    {
        $this->dateOfFlight = $dateOfFlight;

        return $this;
    }

    public function getTimeOfFlightAndStations(): ?array
    {
        return $this->timeOfFlightAndStations;
    }

    public function setTimeOfFlightAndStations(array $timeOfFlightAndStations): self
    {
        $this->timeOfFlightAndStations = $timeOfFlightAndStations;

        return $this;
    }
}

When I try to add field with type json_array via con make:entity it shows me error:

[ERROR] Invalid type "json_array".

My computer says that type “json_array” is invalid, but also says that it is in the list of valid types. How is it possible?

Please, help me, how to deal with this error?

Source: Symfony Questions

Was this helpful?

1 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *