Category : doctrine

So by default API Platform comes with these Donctrine mappings in Doctrine.yaml: mappings: App: is_bundle: false type: annotation dir: ‘%kernel.project_dir%/src/Entity’ prefix: ‘AppEntity’ alias: App However, I’d like to structure my entities in this way: src/Domain/ Product/Entity/*.php Order/Entity/*.php Address/Entity/*.php Is there a way to automatically load these entities without adding a new map to the config? ..

Read more

I simplified my 3 entities as much as possible below, it shows a simple relationship of Currency <- 1:1 -> Balance <- 1:N -> BalanceLog Entity/Currency.php /** * @ORMEntity(repositoryClass=CurrencyRepository::class) */ class Currency { /** * @ORMId * @ORMColumn(type="string", length=3) */ private ?string $code; /** * @ORMOneToOne(targetEntity="Balance", mappedBy="currency") **/ private ?Balance $balance; // … } Entity/Balance.php ..

Read more

I may miss something obvious, but i can’t figure out why my mapping is inconstistent. I use symfony 5.2 and doctrine 2 Here is the bad boy: /** * @var SupportSubscription * * * @ORMManyToOne(targetEntity="SupportSubscription", inversedBy="files", fetch="EAGER") * @ORMJoinColumn(name="id_support_subscription", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ private SupportSubscription $supportSubscription; And the mapped one: /** * @var Collection * ..

Read more

I have the default config in my symfonu project I have this line at .env file DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" and I get this error An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? Of course I dont have ..

Read more

With prior versions of Symfony (<5), it was possible to automatically populate DateTime-fields on creation or when updating existing entries. Example: /** * @var DateTime $createdAt * @GedmoTimestampable(on="create") * @ORMColumn(type="datetime") */ private $createdAt; These annotations do not seem to have any effect if applied onto an Entity in a Symfony5 project. Has a replacement for ..

Read more