2709 search results for Doctrine

... i'm using php 7.4, composer 1.9.1 and symfony cli 4.10.2 on microsofts linux sub system at the moment. and i have to update the doctrine/annotations package and the framework-extra-bundle perhaps you can add "version ...
Ok so, a stupid question. I can't understand how to use roles with database: i've read the guide and view tutorials, but my simple question is: when I create an entity with doctrine, do I need roles column? If yes (I ...
Thanks Diego Aguiar ! yet I did added annotation to Entity class namespace Bla\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Table(name="products") * ORM\Entity(repositoryClass="Bla\Repository ...
Avraham M.
Avraham M.
Read Full Comment
Yes, I managed to do it with Doctrine by following this: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/tutorials/composite-primary-keys.html Down below are the annotations I used for the GenusScientist ...
Totally! ``` use App\Kernel; use Behat\Behat\Context\Context; use Doctrine\Common\DataFixtures\Executor\ORMExecutor; use Doctrine\Common\DataFixtures\Purger\ORMPurger; class FeatureContext implements Context ...
Oh, and to add one more thing! It's not important (for Doctrine) to set the "inverse" side... but we *could* still do this technically, just to keep all our code "in sync". The reason we don't do this (well, technically ...
weaverryan
weaverryan
Read Full Comment
Hey Kristof, This is our custom exception, you can see it here: https://symfonycasts.com/screencast/doctrine-relations/awesome-random-fixtures#codeblock-4640554e87 . So, if you get this - it means you call ...
... that can't be serialized, etc etc etc). It's a big unfortunate side effect of the Doctrine magic. But I don't think that Doctrine can fix it. For them - it's a feature (and they're right). I would love a "smoother" path around this problem, but I can't think of anything... Cheers!
weaverryan
weaverryan
Read Full Comment
Hi Mathias Strasser! Thanks again! At one point, the composer update syntax was "fuzzy" - meaning you could say "doctrine" and it would update all libraries that had "doctrine" in their names. However, it was never ...
weaverryan
weaverryan
Read Full Comment
Hey Dmitriy, Good question! Since slug generated with a listener, it’s not possible to do in doctrine migration. So, you need a so called console migration. It’s a simple Symfony console command where you fetch all ...
... inject the code into Symfony framework. Though, for Doctrine Migrations see https://github.com/doctrine/migrations - that's a standalone library that does not relate to Symfony. Cheers!
... I've been using Symfony and Doctrine for a few months now, but there's always been a couple of things about Doctrine that made me wonder. In this example you have added the argument EntityManagerInterface $em to the ...
Hey Lucas, Good question! You can create an entity in your bundle and even use Doctrine annotation for mapping. Then in your app that uses the bundle you can create an empty class in src/Entity/ dir that will extend ...
32 lines | migrations/Version20200709155920.php
// ... lines 1 - 2
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
// ... lines 9 - 12
final class Version20200709155920 extends AbstractMigration
{
// ... lines 15 - 19
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE question CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE question CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL');
}
}
See Code Block in Script
32 lines | migrations/Version20200707173854.php
// ... lines 1 - 4
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200707173854 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE question (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(100) NOT NULL, question LONGTEXT NOT NULL, asked_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE question');
}
}
See Code Block in Script
29 lines | src/Migrations/Version20180901184240.php
// ... lines 1 - 2
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20180901184240 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE article DROP author');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE article ADD author VARCHAR(255) NOT NULL COLLATE utf8mb4_unicode_ci');
}
}
See Code Block in Script
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
bubble: false
verbosity_levels:
VERBOSITY_VERBOSE: INFO
VERBOSITY_VERY_VERBOSE: DEBUG
channels: ["!doctrine"]
console_very_verbose:
type: console
bubble: false
verbosity_levels:
VERBOSITY_VERBOSE: NOTICE
VERBOSITY_VERY_VERBOSE: NOTICE
VERBOSITY_DEBUG: DEBUG
channels: ["doctrine"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
#swiftmailer:
# delivery_address: me@example.com
See Code Block in Script
29 lines | src/Migrations/Version20180831195803.php
// ... lines 1 - 2
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20180831195803 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE user ADD twitter_username VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE user DROP twitter_username');
}
}
See Code Block in Script
29 lines | src/Migrations/Version20180430194518.php
// ... lines 1 - 2
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20180430194518 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE comment ADD is_deleted TINYINT(1) NOT NULL');
}
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE comment DROP is_deleted');
}
}
See Code Block in Script
68 lines | config/services.yaml
// ... lines 1 - 6
services:
// ... lines 8 - 39
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
Knp\Bundle\MarkdownBundle\MarkdownParserInterface: '@markdown.parser'
Doctrine\ORM\EntityManager: '@doctrine.orm.default_entity_manager'
AppBundle\Service\MarkdownTransformer:
arguments:
$cacheDriver: '@doctrine_cache.providers.my_markdown_cache'
AppBundle\Doctrine\HashPasswordListener:
tags: [doctrine.event_subscriber]
AppBundle\Form\TypeExtension\HelpFormExtension:
tags:
- { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\FormType }
AppBundle\Service\MessageManager:
arguments:
- ['You can do it!', 'Dude, sweet!', 'Woot!']
- ['We are *never* going to figure this out', 'Why even try again?', 'Facepalm']
AppBundle\EventSubscriber\AddNiceHeaderEventSubscriber:
arguments:
$showDiscouragingMessage: true
# example of adding aliases, if one does not exist
# Symfony\Component\Security\Guard\GuardAuthenticatorHandler: '@security.authentication.guard_handler'
See Code Block in Script