$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle 3.48.2 3.54.1 The missing Symfony Admin Generator
sonata-project/block-bundle 3.15.0 3.18.1 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 2.0.1 Cache library
sonata-project/classification-bundle 3.8.0 3.9.2 Symfony SonataClassificationBundle
sonata-project/core-bundle 3.17.0 3.17.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle 2.5.0 3.0.1 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.3.0 1.3.1 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.9.0 3.11.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle 2.5.0 2.5.0 Symfony SonataEasyExtendsBundle
sonata-project/exporter 2.0.1 2.0.1 Lightweight Exporter library
sonata-project/formatter-bundle 3.5.0 4.1.3 Symfony SonataFormatterBundle
sonata-project/google-authenticator 2.2.0 2.2.0 Library to integrate Google Authenticator into a PHP project
sonata-project/intl-bundle 2.6.0 2.7.0 Symfony SonataIntlBundle
sonata-project/media-bundle 3.20.0 3.21.0 Symfony SonataMediaBundle
sonata-project/news-bundle 3.8.0 3.10.1 Symfony SonataNewsBundle
sonata-project/user-bundle 4.3.0 4.5.1 Symfony SonataUserBundle
$ composer show --latest 'symfony/*'
symfony/asset v4.2.8 v5.0.0 Symfony Asset Component
symfony/browser-kit v4.2.8 v5.0.0 Symfony BrowserKit Component
symfony/cache v4.3.8 v5.0.0 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts v1.1.7 v2.0.0 Generic abstractions related to caching
symfony/config v4.2.8 v5.0.0 Symfony Config Component
symfony/console v4.2.8 v5.0.0 Symfony Console Component
symfony/contracts v1.1.0 v2.0.0 A set of abstractions extracted out of the Symfony components
symfony/css-selector v4.2.8 v5.0.0 Symfony CssSelector Component
symfony/debug v4.2.8 v4.4.0 Symfony Debug Component
symfony/dependency-injection v4.2.8 v5.0.0 Symfony DependencyInjection Component
symfony/doctrine-bridge v4.2.8 v5.0.0 Symfony Doctrine Bridge
symfony/dom-crawler v4.2.8 v5.0.0 Symfony DomCrawler Component
symfony/dotenv v4.2.8 v5.0.0 Registers environment variables from a .env file
symfony/event-dispatcher v4.2.8 v5.0.0 Symfony EventDispatcher Component
symfony/expression-language v4.2.8 v5.0.0 Symfony ExpressionLanguage Component
symfony/filesystem v4.2.8 v5.0.0 Symfony Filesystem Component
symfony/finder v4.2.8 v5.0.0 Symfony Finder Component
symfony/flex v1.2.5 v1.4.8 Composer plugin for Symfony
symfony/form v4.2.8 v5.0.0 Symfony Form Component
symfony/framework-bundle v4.2.8 v5.0.0 Symfony FrameworkBundle
symfony/http-foundation v4.3.8 v5.0.0 Symfony HttpFoundation Component
symfony/http-kernel v4.2.12 v5.0.0 Symfony HttpKernel Component
symfony/inflector v4.2.8 v5.0.0 Symfony Inflector Component
symfony/intl v4.2.8 v5.0.0 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/lts dev-master c1affae dev-master c1affae Enforces Long Term Supported versions of Symfony components
Package symfony/lts is abandoned, you should avoid using it. Use symfony/flex instead.
symfony/maker-bundle v1.11.6 v1.14.3 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can for...
symfony/mime v4.3.8 v5.0.0 A library to manipulate MIME messages
symfony/monolog-bridge v4.2.8 v5.0.0 Symfony Monolog Bridge
symfony/monolog-bundle v3.3.1 v3.5.0 Symfony MonologBundle
symfony/options-resolver v4.2.8 v5.0.0 Symfony OptionsResolver Component
symfony/orm-pack v1.0.6 v1.0.7 A pack for the Doctrine ORM
symfony/panther v0.3.0 v0.6.0 A browser testing and web scraping library for PHP and Symfony.
symfony/phpunit-bridge v4.2.8 v5.0.0 Symfony PHPUnit Bridge
symfony/polyfill-intl-icu v1.11.0 v1.12.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn v1.11.0 v1.12.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring v1.11.0 v1.12.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.11.0 v1.12.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/process v4.2.8 v5.0.0 Symfony Process Component
symfony/profiler-pack v1.0.4 v1.0.4 A pack for the Symfony web profiler
symfony/property-access v4.2.8 v5.0.0 Symfony PropertyAccess Component
symfony/property-info v4.3.4 v5.0.0 Symfony Property Info Component
symfony/routing v4.2.8 v5.0.0 Symfony Routing Component
symfony/security-acl v3.0.2 v3.0.2 Symfony Security Component - ACL (Access Control List)
symfony/security-bundle v4.2.8 v5.0.0 Symfony SecurityBundle
symfony/security-core v4.2.8 v5.0.0 Symfony Security Component - Core Library
symfony/security-csrf v4.2.8 v5.0.0 Symfony Security Component - CSRF Library
symfony/security-guard v4.2.8 v5.0.0 Symfony Security Component - Guard
symfony/security-http v4.2.12 v5.0.0 Symfony Security Component - HTTP Integration
symfony/serializer v4.2.8 v5.0.0 Symfony Serializer Component
symfony/service-contracts v1.1.8 v2.0.0 Generic abstractions related to writing services
symfony/stopwatch v4.2.8 v5.0.0 Symfony Stopwatch Component
symfony/swiftmailer-bundle v3.2.6 v3.4.0 Symfony SwiftmailerBundle
symfony/templating v4.2.8 v5.0.0 Symfony Templating Component
symfony/test-pack v1.0.5 v1.0.6 A pack for functional and end-to-end testing within a Symfony app
symfony/translation v4.2.8 v5.0.0 Symfony Translation Component
symfony/twig-bridge v4.2.8 v5.0.0 Symfony Twig Bridge
symfony/twig-bundle v4.2.8 v5.0.0 Symfony TwigBundle
symfony/validator v4.2.8 v5.0.0 Symfony Validator Component
symfony/var-dumper v4.2.8 v5.0.0 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter v4.3.8 v5.0.0 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-profiler-bundle v4.2.8 v5.0.0 Symfony WebProfilerBundle
symfony/web-server-bundle v4.2.8 v4.4.0 Symfony WebServerBundle
symfony/yaml v4.2.8 v5.0.0 Symfony Yaml Component
$ php -v
PHP 7.3.6 (cli) (built: May 31 2019 23:38:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.6, Copyright (c) 1999-2018, by Zend Technologies
Expected argument of type "App\Entity\KnowledgeBase\Category", "NULL" given at property path "category" - This error occurs when you delete an object from a sheet and leave it empty. When created, it is validated, does not allow to save, because the 'category' field is null.
When the field is not empty, everything is OK.
But when you go to edit this form, and with an empty field, when you click on the "Edit" button, validation does not work, and you get an error





Validation should work correctly when changed
The data in the object is the same. What when creating, what when changing


Video guide for reproduce: https://drive.google.com/open?id=1kHiXDcp-LVLJUpk8QMwQV_hefVGaFNDZ
You are lazy. We are lazy and won't watch any video. Sorry.
Please fill out the issue template and describe the problem. Please reduce this to the minimum that is needed to get the problem
Video guide for reproduce: https://drive.google.com/open?id=1kHiXDcp-LVLJUpk8QMwQV_hefVGaFNDZ
You are lazy. We are lazy and won't watch any video. Sorry.
Please fill out the issue template and describe the problem. Please reduce this to the minimum that is needed to get the problem
I updated the comment
Show your entities configuration.
Show your entities configuration.
Hi, er1z.
<?php declare(strict_types = 1);
namespace App\Entity\KnowledgeBase;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="knowledge_base_category")
* @ORM\Entity(repositoryClass="Doctrine\ORM\EntityRepository")
*/
class Category.php
{
/**
* @ORM\Id()
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
* @var int
*/
protected $id;
/**
* @ORM\Column(type="string", nullable=false)
* @var string
*/
protected $name;
public function getName(): string
{
return $this->name ?? '';
}
public function setName(string $name): void
{
$this->name = $name;
}
public function getId(): int
{
return $this->id;
}
public function setId(int $id): void
{
$this->id = $id;
}
public function __toString(): string
{
return $this->getName();
}
}
<?php declare(strict_types = 1);
namespace App\Entity\KnowledgeBase;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(name="knowledge_base")
* @ORM\Entity(repositoryClass="Doctrine\ORM\EntityRepository")
* @UniqueEntity(
* fields={"url"},
* message="This url is already use."
* )
*/
class KnowledgeBase
{
/**
* @ORM\Id()
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
* @var int
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\KnowledgeBase\Category")
* @ORM\JoinColumn(name="category_id", referencedColumnName="id")
* @Assert\NotBlank
* @var Category
*/
protected $category;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\KnowledgeBase\Subcategory")
* @ORM\JoinColumn(name="subcategory_id", referencedColumnName="id", nullable=true)
* @var Subcategory|null
*/
protected $subcategory;
/**
* @ORM\Column(type="string")
* @var string
*/
protected $title;
/**
* @ORM\Column(type="string", unique=true, nullable=false)
* @var string
*/
protected $url;
/**
* @ORM\Column(type="text")
* @var string
*/
protected $description;
public function getId(): int
{
return $this->id;
}
public function getTitle(): string
{
return $this->title ?? '';
}
public function setTitle(string $title): void
{
$this->title = $title;
}
public function getUrl(): string
{
return $this->url ?? '';
}
public function setUrl(string $url): void
{
$this->url = $url;
}
public function getDescription(): string
{
return $this->description ?? '';
}
public function setDescription(string $description): void
{
$this->description = $description;
}
/**
* @return Category|string|null
*/
public function getCategory()
{
return $this->category;
}
public function setCategory(Category $category): void
{
$this->category = $category;
}
/**
* @return Subcategory|string|null
*/
public function getSubcategory()
{
return $this->subcategory;
}
public function setSubcategory(?Subcategory $subcategory): void
{
$this->subcategory = $subcategory;
}
}
There's your problem:
public function setCategory(Category $category): void
Closing this, as we try to keep github issues for feature requests and bugs only.
Thanks! It is works! Sorry for my carelessness :)
I could really think that this is a bug
Most helpful comment
There's your problem: