Asked  1 Year ago    Answers:  5   Viewed   15 times

I am trying to go trough tutorial of doctrine here is official website. And I got an error in Starting with the Product Entity part.

This is what I write to terminal: $ php create_product.php ORM

PHP Fatal error:  Uncaught Error: Class 'product' not found in /home/vaclav/Server/vssk/VSSK/project/create_product.php:8
Stack trace: #0 {main}
  thrown in /home/vaclav/Server/vssk/VSSK/project/create_product.php on line 8

 Answers

1

Solved with adding:

require_once 'patch_to_your_class/Product.php';

to create_product.php.

Saturday, May 29, 2021
 
RahulG
 
3

OK, I found the solution. This requires little change in cli-config as below:

$helperSet = new SymfonyComponentConsoleHelperHelperSet(array(
    'db' => new DoctrineDBALToolsConsoleHelperConnectionHelper($em->getConnection()),
    'em' => new DoctrineORMToolsConsoleHelperEntityManagerHelper($em)
));
return $helperSet;

In previous versions, only including the cli-config.php file would be OK(it expected a variable named '$helperSet' ). But, in new version, it requires to return the variable and get it assigned to its internal variable.

Saturday, May 29, 2021
 
macha
 
5

Before you call $client = new Google_Client; you should load the Google class (library) file in you code.

That is missing and so resulting as an error.

Saturday, May 29, 2021
 
Jauco
 
5

If you don't use composer to install the Stripe library you will need to manually include all of the Stripe classes.

Composer is the preferred way as it will handle the autoloading of classes. Here is a sample composer file:

{
  "require": {
    "stripe/stripe-php": "2.*"
  }
}

And then from a command line you would need to run composer update while in the directory for your project. Afterwards, just add require 'vendor/autoload.php'; to the top of your php file.

Otherwise, replace require('/var/www/stripe-php-2.1.1/lib/Stripe.php');with this code to include all of the classes:

$stripeClassesDir = __DIR__ . '/stripe-php-2.1.1/lib/';
$stripeUtilDir    = $stripeClassesDir . 'Util/';
$stripeErrorDir   = $stripeClassesDir . 'Error/';

set_include_path($stripeClassesDir . PATH_SEPARATOR . $stripeUtilDir . PATH_SEPARATOR . $stripeErrorDir);

function __autoload($class)
{
    $parts = explode('\', $class);
    require end($parts) . '.php';
}
Monday, August 16, 2021
 
2

The issue is not so much that Query Builder cannot create queries for the (non-standard) REGEXP functionality in MySQL but more that even if you can generate your query, there is no way the DQL parser will understand it without doing something about it.

That "something" is extending Doctrine’s DQL to understand the regular expression syntax. This is doable by extending the DQL as described in a blog post.

For more information study the code of the MySQL part of DoctrineExtensions

Tuesday, August 17, 2021
 
Steve
 
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :