doctrine

using doctrine 2 with SQL Server

坚强是说给别人听的谎言 提交于 2020-01-14 06:14:13
问题 I need to migrate an existing project, built on the current beta of doctrine 2, from mysql to SQL Server. I have complete control of the SQL Server. In the DBAL Folder of Doctrine there already is a PDOMsSql driver, but I can't figure out, how to use it. (there is still no documentation) Doctrine also offers two other ways, I could maybe use: driverClass: Specifies a custom driver implementation if no 'driver' is specified. This allows the use of custom drivers that are not part of the

Connection to a db with Doctrine pdo_sqlsrv

余生长醉 提交于 2020-01-14 03:37:07
问题 I'm trying to connect to my database in SQL Server 2000, but i get an error could not find driver when i'm using pdo_sqlsrv. But if i use sqlsrv i get an error Attempted to call function "sqlsrv_configure" from namespace "Doctrine\DBAL\Driver\SQLSrv". Here is my config.yml config.yml doctrine: dbal: default_connection: default connections: default: dbname: "%database_name%" user: "%database_user%" password: "%database_password%" host: "%database_host%" driver: pdo_mysql charset: utf8mb4

Symfony 1.4 doctrine - many-to-many relationship with extra field in intermediate table

笑着哭i 提交于 2020-01-14 02:48:27
问题 There are 3 tables: shelf, section and shelf_has_section intermediate table to support n-m relation. The schema build from symfony doctrine:build-schema looks as following. Simply, shelf(id, position) section(id, name) shelf_has_section(shelf_id, section_id, number_of_books) The schema. Shelf: connection: doctrine tableName: shelf columns: id: type: integer(4) fixed: false unsigned: true primary: true autoincrement: true position: type: string(255) primary: false notnull: true autoincrement:

Sylius Product Bundle configuration

橙三吉。 提交于 2020-01-13 18:16:44
问题 I'm trying to integrate Sylius Product Bundle into my existing Symfony project. It already has doctrine configured. This is the error I am getting: [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] The child node "driver" at path "sylius_attribute" must be configured. Any idea what's causing this? I followed the instruction right off the bat without doing any other installations of sylius. http://docs.sylius.org/en/latest/bundles/SyliusProductBundle/installation

Symfony2 and Doctrine, Column cannot be null with OneToOne relationships

微笑、不失礼 提交于 2020-01-13 17:58:09
问题 Here is an entity ( EDITED: full file content ) // Eve\MoonBundle\Entity\MoonMaterial.php namespace Eve\MoonBundle\Entity; use Doctrine\ORM\Mapping as ORM; //use Doctrine\Common\Collections\ArrayCollection; /** * @ORM\Table(name="_moon_material") * @ORM\Entity() */ class MoonMaterial { public function __construct() { //$this->invTypes_byTypeID = new ArrayCollection(); } // relations start /** * @ORM\OneToOne(targetEntity="Eve\DumpBundle\Entity\invTypes") * @ORM\JoinColumn(name="typeID",

Doctrine 2 Pagination with Association Mapping

坚强是说给别人听的谎言 提交于 2020-01-13 13:50:32
问题 I am wondering how can you paginate the results obtained from an entity association mapping in Doctrine 2? For example class Customer { /** * @OneToMany(targetEntity="Order") */ private $orders; } can be used as such: $customer->getOrders(); which will return a collection of Order objects. The problem is when there are a large number of order objects. We can use Doctrine\ORM\Tools\Pagination\Paginator when building custom queries, however I do not see any way to hook into query generation

Symfony and Doctrine making migration with no effect

笑着哭i 提交于 2020-01-13 09:59:06
问题 Doctrine is generating migration in symfony and nothing changes afer running the migration so during next diff it is the same. How to make Doctrine not generate this migration? Running the alter table command manually does not remove column collation. bin/console doctrine:migration:diff up $this->addSql('ALTER TABLE session CHANGE sess_id sess_id VARCHAR(128) NOT NULL'); down $this->addSql('ALTER TABLE session CHANGE sess_id sess_id VARCHAR(128) NOT NULL COLLATE utf8_unicode_ci'); Table looks

Doctrine mapped field is not working

此生再无相见时 提交于 2020-01-13 06:00:10
问题 I have two entities User\User and Misc\Notification and I want to have the possibility to fetch the user's notifications inside the User entity, by doing $user->getNotifications() . Usually I have no problem with this type of relations. See my code below (I just added the TicketApp relation as an example, since this relation works and is exactly the same): User\User : properties /** * This is working * @ORM\OneToMany(targetEntity="[...]\Entity\Ticket\TicketApp", mappedBy="author") */ private

Persist and flush - Doctrine and MongoDB

一曲冷凌霜 提交于 2020-01-13 05:27:27
问题 How fast is flush()? I'm adding several thousand item to a collection with persist(), then emptying the collection then flushing it. $dm = $this->get('doctrine.odm.mongodb.document_manager'); while(stuff)) { $item = new Item(); $item->setItem("item stuff"); $dm->persist($item); } $qb = $dm->createQueryBuilder('Bundle:Item')->remove(); $query = $qb->getQuery(); $query->execute(); $dm->flush(); I want to know how much time will the collection stay empty. Between the remove and the flush. 回答1: I

How to catch an id from sfUser?

六月ゝ 毕业季﹏ 提交于 2020-01-11 10:48:07
问题 I'm working with symfony 1.4 & i use sfDoctrineGuardPlugin as a tool for authentifications. I want to catch the Id of user in order te store it in my table. After a small research, I guess I have to use that expression : getUser()->getGuardUser()->getId() . What i looking for is how to invest that expression for my target. 回答1: if the user is authenticated, yes, you can use: // inside an action $id = $this->getUser()->getGuardUser()->getId(); // inside a template $id = $sf_user->getGuardUser(