0

I have downloaded the latest version of Drupal 8 my project structure looks like:

private/
  EntityOne.php 
  EntityTwo.php
  Test.php => Test Script (Eventually AUT)
public/
  index.php => Drupal Engine

Inside Test.php I wish to begin building a series of entities which at first will be used externally and eventually be moved into Drupal modules.

I have Googled and spent hours trying to get Doctrine to start letting me build tables with my entities, but I am doing something wrong.

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html#obtaining-the-entitymanager

Is of no help, there is no "vendor/autoload.php" but there is a "core/vendor/autoload.php"

I can include this file in Test.php and everything is fine but when I start adding code:

  include '../public/core/vendor/autoload.php';

  use Doctrine\ORM\Tools\Setup;
  use Doctrine\ORM\EntityManager;

  // Create a simple "default" Doctrine ORM configuration for Annotations
  $isDevMode = true;
  $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src"), $isDevMode);

I get an error:

Fatal error: Class 'Doctrine\ORM\Tools\Setup' not found in ...\private\index.php on line 10

There is no "Doctrine/ORM"

What am I missing???

Alex

  • D8 supports Doctrine ORM? Really?! I thought that had been chucked out? I can't see any of the ORM classes under vendor/doctrine, just the Doctrine\Common namespace... – Clive Sep 30 '13 at 15:02
  • Ya apparently, I just read a blog that stated this...they use the annotations or something but not the ORM itself...why wouldn't they leave it for people like me :( – Alex.Barylski Sep 30 '13 at 15:05
  • Yep that sounds familiar :/ – Clive Sep 30 '13 at 15:07
  • As far as I know Drupal 8 does not have the full Doctrine ORM setup, just a bunch of small parts. So the Doctrine\ORM\Tools\Setup doesn't actually exist. If you want it you'll have to manually add it. – Steven Sep 30 '13 at 15:18
4

Drupal 8 uses the annotation reader from Doctrine Common but it does not use the ORM. The handbook page for the Drupal entity field API is being written at https://drupal.org/node/2078191

  • Yes, Drupal's Entity Field API has nothing to do with Doctrine. – Berdir Oct 1 '13 at 7:08
  • Potentially though you could write a doctrine based entity storage controller, which than would allow you to go to PSRCR or whatever. – Daniel Wehner Oct 23 '13 at 12:30
  • why wouldn't they use doctrine? couldn't standardization be good, I want to try drupal, because it could be faster than symfony, but it is looking like some key components are going to be different huh – hounded Jan 27 '17 at 0:56
  • Drupal wants to do everything different. They don't stick to PSR-2 either. Unfortunately, they want to be leaders and drivers in the PHP community, but the Drupal community isn't big enough to have that impact. For what it's worth, the product is still useful, but you have to become familiar with the way they do stuff, and many times, you'll see that the decision was not right, so it can change too. – Meezaan-ud-Din May 16 '17 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.