FlextrineService.SelectOne( )

11 views
Skip to first unread message

chussenot

unread,
Mar 23, 2011, 10:39:36 AM3/23/11
to flextrine
I've got a require warning...
I use flextrine Query in actionscript
SELECT u FROM com\emeth\handy\vo\User u WHERE u.id=722281218

and got this response :

Warning: require(/Users/chussenot/Sites/web/flextrine/php/app/handy-
dev/entities//Flextrine/Query.php): failed to open stream: No such
file or directory in /Users/chussenot/Sites/web/flextrine/php/lib/
Doctrine/Common/ClassLoader.php on line 148

Fatal error: require(): Failed opening required '/Users/chussenot/
Sites/web/flextrine/php/app/handy-dev/entities//Flextrine/
Query.php' (include_path='.:/usr/local/zend/share/pear:/Users/
chussenot/Sites/web/flextrine/php/lib') in /Users/chussenot/Sites/web/
flextrine/php/lib/Doctrine/Common/ClassLoader.php on line 148

how to fix this, including class in bootstrap, entitie, or gateway php
files don't work...
any ideas ?

chussenot

unread,
Mar 23, 2011, 10:43:02 AM3/23/11
to flextrine
loadAll( ) is working... persist and flush() don't
I've got the very last version from GIT

chussenot

unread,
Mar 23, 2011, 11:33:38 AM3/23/11
to flextrine
on flush( ) i've got this error

Fatal error: Cannot redeclare class Flextrine\Collections
\FlextrinePersistentCollection in /Users/chussenot/Sites/web/flextrine/
php/lib/Flextrine/Collections/FlextrinePersistentCollection.php on
line 0

chussenot

unread,
Mar 23, 2011, 11:34:10 AM3/23/11
to flextrine
<?php
/**
* Copyright 2011 Dave Keen
* http://www.actionscriptdeveloper.co.uk
*
* This file is part of Flextrine.
*
* Flextrine is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* and the Lesser GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace Flextrine\Collections;

use Doctrine\Common\Collections\ArrayCollection;

class FlextrinePersistentCollection extends ArrayCollection {

/**
* FlextrinePersistentCollections coming from the client are always
initialized
*/
public function isInitialized() {
return true;
}

public function __set($name, $value) {
if ($name == "source")
$this->__construct($value);
}

}

ccapndave

unread,
Mar 23, 2011, 11:37:48 AM3/23/11
to flextrine
During your selectOne can I just confirm that you are using
QueryUtil.getDQLClass instead of putting the class namespace directly
into the query?

e.g.

em.selectOne(new Query("SELECT u FROM " + QueryUtil.getDQLClass(User)
+ " u WHERE u.id=722281218"))


On Mar 23, 4:34 pm, chussenot <chusse...@gmail.com> wrote:
> <?php
> /**
>  * Copyright 2011 Dave Keen
>  *http://www.actionscriptdeveloper.co.uk

chussenot

unread,
Mar 23, 2011, 12:14:50 PM3/23/11
to flextrine
1/

I confirm for selectOne( ) :
em.selectOne( new Query("SELECT u FROM " + QueryUtil.getDQLClass(User)
+ " u WHERE u.facebook="+response.id ) ).addResponder( new
FlextrineResponder( ....

2/

I fix my flush( ) problem by removing two lines in bootstrap

// We need an extra class loader for the entities and services
directory themselves; use empty namespace as there could be anything
in here

$entityClassLoader = new ClassLoader(null,
APP_PATH.DIRECTORY_SEPARATOR.$appConfig["directories"]["entities"]);
$entityClassLoader->register();

can you explain me why you use Doctrine Loader and put this ?

chussenot

unread,
Mar 23, 2011, 12:18:29 PM3/23/11
to flextrine
for now all is working fine...
do you think i can keep the $entityClassLoader code fragment in
comment ?

ccapndave

unread,
Mar 24, 2011, 1:43:46 PM3/24/11
to flextrine
That's strange - without those two lines I can't understand how PHP is
managing to auto-load your entities. The point of that ClassLoader is
to fall back to the 'entities' directory in order to search for a
namespace (after looking in all the others).

So when you try to use com\emeth\handy\vo\User, it knows to look for
app\{app_name}\entities\com\emeth\handy\vo\User.php

Note that if you were using a version of Flextrine before 0.9 and
upgraded you'll need to regenerate your project using the flextrine
app:create command as the directory structure has changed (but I
expect you did this otherwise loadAll wouldn't work either).

Any ideas?

Dave

Clement Hussenot-Desenonges

unread,
Mar 24, 2011, 2:09:06 PM3/24/11
to flex...@googlegroups.com
Hi Dave,

I use your new flextrine version and doctrine wrapper with ant tasks (
update, create, insert fixtures,...)
It's really cool...

I think that universalClassLoader do the autoload job... And now
everything is ok without those two lines...

my bug is bring about multiple "require", I think that you must use
only one classLoader... ( doctrine or synfony or ... )

Thanks for your great work.

Clément Hussenot - Emeth Animation
5 passage Piver - 75011 Paris
GSM: +33(0)616772183
Office: +33(0)1 48 07 30 81
Fax: +33(0)957466207
chus...@emeth-animation.com

Emeth Animation
TVA : FR45485341515
Siret : 48534151500016
NAF : 921A

Dave Keen

unread,
Mar 24, 2011, 2:27:55 PM3/24/11
to flex...@googlegroups.com
That's cool :)  I'm also using it with Capistrano to update/create/generate proxies etc on the server during staging and deployment.

Have you edited the UniveralClassLoader code in bootstrap.php?  Right now it has:

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
    'Flextrine'                     => __DIR__."/../lib",
    'Doctrine'                   => __DIR__.'/../lib',
    'Symfony'                    => __DIR__.'/../lib/Doctrine',
));
$loader->registerPrefixes(array(
    'Zend_'                         => __DIR__."/../lib",
    'Flextrine_'                 => __DIR__."/../lib",
));
$loader->register();

So I don't see how this can do anything with the entities directory.  Thinking about it, the line that you removed:


    $entityClassLoader = new ClassLoader(null, APP_PATH.DIRECTORY_SEPARATOR.$appConfig["directories"]["entities"]);
    $entityClassLoader->register();

is basically a way of adding APP_PATH.DIRECTORY_SEPARATOR.$appConfig["directories"]["entities"] (app/{app_name}/entities) to the include_path, so maybe this would be better dealt with using set_include_path.

But anyway, I still can't see how your application is finding stuff in your entities folder?

Dave
}
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.894 / Virus Database: 271.1.1/3525 - Release Date: 03/23/11 20:34:00

Reply all
Reply to author
Forward
0 new messages