0

I have an entity:

<?php

namespace App\Entity\Aero;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass="App\Repository\Aero\ScheduleRepository")
 */
class Schedule
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="date")
     */
    private $dateOfFlight;

    /**
     * @ORM\Column(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?

1 Answer 1

1

Solved it by adding "json_array" manually instead of "json" in:

  /**
   * @ORM\Column(type="json_array")
   */
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.