Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3693500
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:23:05+00:00 2026-05-19T04:23:05+00:00

I’m working with Zend and Doctrine2 and I needed to create some cronjobs using

  • 0

I’m working with Zend and Doctrine2 and I needed to create some cronjobs using the same structure. the problem is, when I tried to get the repository from a Model with relationship with another Model, I got an error (only in command-line, in the website works fine if I do the same).

This is the error I get in the command-line:

Fatal error: Class ‘Proxy\Model_MediaPresetsProxy’ not found in c:\php\library\Doctrine\ORM\Proxy\ProxyFactory.php on line 92

I have the proxies in this folder /application/models/proxies/ and the file Model_MediaPresetsProxy is in that directory

<?php

namespace Proxy;

/**
 * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
 */
class Model_MediaPresetsProxy extends \Model_MediaPresets implements \Doctrine\ORM\Proxy\Proxy
{
[...]

Here is what I created for the crons

/crons/init.php

<?php

$time = microtime(true);
$memory = memory_get_usage();

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', 'cldev');

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

defined('NL')
    || define('NL', "\n");

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap();

// set bootstrap param 
$bootstrap = $application->getBootstrap(); 
$front = $bootstrap->getResource('FrontController');
$front->setParam('bootstrap', $bootstrap); 

register_shutdown_function('__shutdown');

function __shutdown()
{
    global $time, $memory;
    $endTime = microtime(true);
    $endMemory = memory_get_usage();

    echo '
    Time [' . ($endTime - $time) . '] Memory [' . number_format(( $endMemory - $memory) / 1024) . 'Kb]
';
}

and then I created my cronjob to test that everything was working

/crons/queue/processQueue.php

<?php 

require realpath( dirname(__FILE__) . '/../init.php');


$paths = Helper_Media::getPaths();
$magick = new App_PhMagick();

$em = Zend_Registry::getInstance()->entityManager;

$queue = $em->getRepository('Model_MediaQueue')->findAll();

echo 'Items in the queue: ' . count($queue) . NL;

And this are the models I’m using for that

/application/models/MediaQueue.php

<?php

use Doctrine\Common\Collections\ArrayCollection;

/**
 * @Entity
 * @Table(name="media_queue")
 */
class Model_MediaQueue
{
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $queue_id;


    /** 
     * @ManyToOne(targetEntity="Model_MediaPresets")
     * @JoinColumn(name="queue_preset_id", referencedColumnName="preset_id")
     */
    private $media_preset;

    /** 
     * @ManyToOne(targetEntity="Model_Sites", inversedBy="media_list")
     * @JoinColumn(name="queue_site_id", referencedColumnName="site_id")
     */
    private $media_site;

    /** 
     * @Column(type="string")
     */
    private $source_media_file;

    /** @Column(type="integer") */
    private $result_media_id;

    /** @Column(type="integer") */
    private $queue_status;

    /** @Column(type="integer") */
    private $queue_added;

    /** @Column(type="integer") */
    private $queue_processed;


    public function __construct()
    {
        $this->media_preset = new \Doctrine\Common\Collections\ArrayCollection();
        $this->media_site = new \Doctrine\Common\Collections\ArrayCollection();
    }

    [...]
}

/application/models/MediaPresets.php

<?php

/**
 * @Entity
 * @Table(name="media_presets")
 */
class Model_MediaPresets
{
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $preset_id;

    /** 
     * @Column(name="preset_type", type="string", columnDefinition="enum('video', 'photo')") 
     */
    private $preset_type;

    /** @Column(type="string") */
    private $preset_name;

    /** @Column(type="string") */
    private $preset_formats_order;

    /** @Column(type="integer") */
    private $preset_size_w;

    /** @Column(type="integer") */
    private $preset_size_h;

    /** 
     * @Column(name="preset_resize_method", type="string", columnDefinition="enum('Maintain', 'Stretch', 'Centre', 'Abort')") 
     */
    private $preset_resize_method;

    /** @Column(type="string") */
    private $preset_watermark;

    /** @Column(type="string") */
    private $preset_background;

}

any clues?

Many thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:23:05+00:00Added an answer on May 19, 2026 at 4:23 am

    Well after a while I found myself the solution.

    The problem was that I created 2 different Environments: DEVELOPMENT and CLDEV (Command-line development)

    and my getEntityManager() function had a line with

    [...]
    $config->setAutoGenerateProxyClasses((APPLICATION_ENV == 'development'));
    [...]
    

    So I replaced it with

    [...]
    $config->setAutoGenerateProxyClasses((APPLICATION_ENV == 'development' || APPLICATION_ENV == 'cldev'));
    [...]
    

    and the problem is solved. Hope it will help somebody else in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I've tracked down a weird MySQL problem to the two different ways I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.