473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Symfony 2.*, doctrine:fixtures:load givesPHP Fatal error: class not found

103 100+
I am following course:
https://www.udemy.com/introduction-to-web-development-with-symfony2/#/lecture/933870
Lecture 38.

In short, they explain how to create Blog website.
There are Model and Core bundles.
There are Author and Post entities in Model bundle (Author and Post controllers in Core bundle).

I have successfully created slug column in Author table with doctrine:migrations:diff and doctrine:migrations:migrate.
But i can not generate slug contents, because command:
doctrine:fixtures:load gives a PHP fatal error:
"PHP Fatal error: Class 'Blog\Model\Bundle\Repository\AuthorRepository' not foun
d in C:\Bitnami\wampstack-5.4.38-0\sym_prog\myproject\vendor\doctrine\orm\lib\Do
ctrine\ORM\Repository\DefaultRepositoryFactory.php on line 75"


I have compared four related (from my point of view) Author files :
1) src\Blog\ModelBundle\Entity\Author.php
2) src\Blog\CoreBundle\Controller\AuthorController.ph p
3) src\Blog\ModelBundle\Repository\AuthorRepository.p hp
4) src\Blog\ModelBundle\DataFixtures\ORM\10-Authors.php

with files provided at the end of the course. There is no difference. I also compared them with Post files, i mean i checked the namespaces i import - again i import and use the adequate namespace as in Post, where slugs were created successfully.

What are other files which doctrine:fixtures:load touch? Where i should search for mistake?
Mar 23 '15 #1
2 2409
gintare
103 100+
Using information from
http://www.sitepoint.com/data-fixtures-symfony2/

I figured that command:
php app/console doctrine:fixtures:load

loads fixtures from file "your project root/src/your bundle namespace/DataFixtures/ORMĖ.

In my case, the directory and file is "C:\Bitnami\wampstack-5.4.38-0\sym_prog\myproject\src\Blog\ModelBundle\DataFixt ures\ORM\10-Authors.php"

The file contents:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. namespace Blog\ModelBundle\DataFixtures\ORM;
  4.  
  5. use Blog\ModelBundle\Entity\Author;
  6. use Doctrine\Common\DataFixtures\AbstractFixture;
  7. use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
  8. use Doctrine\Common\Persistence\ObjectManager;
  9.  
  10. /**
  11.  * Fixtures for the Author Entity
  12.  */
  13.  
  14. class Authors extends AbstractFixture implements OrderedFixtureInterface
  15. {
  16.     /**
  17.      * {@inheritDoc}
  18.      */
  19.     public function getOrder()
  20.     {
  21.         return 10;
  22.     }
  23.  
  24.     /**
  25.      * {@inheritDoc}
  26.      */
  27.     public function load(ObjectManager $manager)
  28.     {
  29.         $a1 = new Author();
  30.         $a1->setName('David');
  31.  
  32.         $a2 = new Author();
  33.         $a2->setName('Eddie');
  34.  
  35.         $a3 = new Author();
  36.         $a3->setName('Elsa');
  37.  
  38.         $manager->persist($a1);
  39.         $manager->persist($a2);
  40.         $manager->persist($a3);
  41.  
  42.         $manager->flush();
  43.     }
  44. }
Where can be the mistake, which gives PHP Fatal error: class not found?

What are other files, which are touches by doctrine:fixtures:load ? I.e., where i should search for a mistake?
Mar 23 '15 #2
gintare
103 100+
The error was in file:
C:\Bitnami\wampstack-5.4.38-0\sym_prog\myprojec\src\Blog\ModelBundle\Entity\Au thor.php

Instead of line:
@ORM\Entity(repositoryClass="Blog\Model\Bundle\Rep ository\AuthorRepository")

It should be only: @ORM\Entity()
or @ORM\Entity(repositoryClass="Blog\ModelBundle\Repo sitory\AuthorRepository")

There was misspelling mistake Model\Bundle instead of ModelBundle
Mar 23 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Daniel Hansen | last post by:
I am getting a "Fatal error: Call to undefined function: imagecreatefromjpeg() in..." error in one of my scripts, and after doing a bit of searching on the 'net I found various messages relating to...
3
by: PeterF | last post by:
Hello, what is wrong here? the purpose is to create an array of objects and then interate over it, calling some method from all of them. I get just the following at the marked line ("// FATAL...
2
by: Phil Powell | last post by:
Actually the client is saying it sometimes happens and sometimes doesn't happen, and when they refresh their screen it clears itself (I assume the memory clears). Here is line 1135: $result =...
2
by: Itjalve | last post by:
This gives me a fatal error. I'm using .NET VC7.1 and made a win32 consol app, I have no problems with VC6. Debug build. I have removed nearly all my code this is whats left. From the beginning...
4
by: ARF | last post by:
I'm testing AutoCAD 2005 automation via VS2005 Pro C++/CLR and I'm getting fatal compiler errors. I start with a default C++/CLR class library project and modify it by adding the following...
5
by: phpbilder | last post by:
dear friends, i am using visual studio php from jcx software (version 5.2.5) and apache from apache friends.com (version 1.6.6a), now i am trying to transform a xml document to a xsl...
2
by: leisablu | last post by:
Hello, Im not good in scrpting, its like readind jibberish...lol...My problem is im trying to convert my phpbb 2.0 to phpbb 3.0 and im getting 1 500 internal error and to check my PHP error log. whrn...
17
by: pranavb85 | last post by:
Hi, I have searched around for the solution to this problem, but I am trying to call a perl script from php, and get a fatal error:Class perl not found I am using php 5.1.6 and apache 2.0 , php...
0
oll3i
by: oll3i | last post by:
Hello, I try to make a website with kohana. I get error ErrorException : Class 'Controller_Template_Website' not found for the code 1 <?php defined('SYSPATH') or die('No direct script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.