Q
Q
Qwyu_4iLofK2022-03-14 22:34:29
symfony
Qwyu_4iLofK, 2022-03-14 22:34:29

How to set json value?

/**
 * @ORM\Entity(repositoryClass=DeliveryRepository::class)
 */
class Delivery {
/**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;
    /**
     * @ORM\Column(type="json", nullable=true)
     */
    private json = [];
public function getJson()
    {
        return $this->json;
    }

    public function setJson($json): self
    {
        $this->json = $json;

        return $this;
    }

}

$d=new Delivery();
$d->setJson(["fff"=>["ff"=>[1,3]],"hh3"=>[7,8]]); // пробовала 1
$d->setJson(["fff"]); // пробовала 2


does not save throws an error
Call to a member function setJson() on array

googled, didn't find anything...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question