This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

[Askeet Day 2] symfony propel-generate-crud problem

Discussion around this tutorial for symfony 1.0.x

[Askeet Day 2] symfony propel-generate-crud problem

by Balth » Thu Nov 15, 2007 4:32 pm

Hello,

I'm following the askeet tuto and for now, I try to "Test data access via a CRUD"

Code: Select all
/var/www/my_project sudo symfony propel-generate-crud my_app-name evaluateur Evaluateur

Parse error: syntax error, unexpected T_EVAL, expecting '&' or T_VARIABLE in /var/www/my_project/lib/model/om/BaseEvaluateur.php on line 622


I don't understand the error.
I built a schema.xml :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
 <database name="propel" defaultIdMethod="native" noxsd="true">

   <table name="projet" phpName="Projet">
     <column name="idprojet" type="integer" required="true" primaryKey="true" autoIncrement="true" />
     <column name="idgroupe" type="integer" />
     <foreign-key foreignTable="groupe">
       <reference local="idgroupe" foreign="idgroupe"/>
     </foreign-key>
     <column name="nomprojet" type="varchar" size="50" />
     <column name="urlprojet" type="varchar" size="100" />
     <column name="versionprojet" type="varchar" size="10" />
     <column name="descriptionprojet" type="longvarchar" />
     <column name="creationprojet" type="timestamp" />
     <column name="majprojet" type="timestamp" />
   </table>

   <table name="groupe" phpName="Groupe">
     <column name="idgroupe" type="integer" required="true" primaryKey="true" autoIncrement="true" />
     <column name="nomgroupe" type="varchar" size="50" />
   </table>
 
   <table name="evaluation" phpName="Eval">
     <column name="idevaluation" type="integer" required="true" primaryKey="true" autoIncrement="true" />
     <column name="idprojet" type="integer" />
     <foreign-key foreignTable="projet">
       <reference local="idprojet" foreign="idprojet"/>
     </foreign-key>
     <column name="idevaluateur" type="integer" />
     <foreign-key foreignTable="evaluateur">
       <reference local="idevaluateur" foreign="idevaluateur"/>
     </foreign-key>
     <column name="idcategorie" type="integer" />
     <foreign-key foreignTable="categorie">
       <reference local="idcategorie" foreign="idcategorie"/>
     </foreign-key>
     <column name="commentaireevaluation" type="longvarchar" />
     <column name="noteevaluation" type="integer" />
     <column name="dateevalution" type="timestamp" />
   </table>
 
   <table name="evaluateur" phpName="Evaluateur">
     <column name="idevaluateur" type="integer" required="true" primaryKey="true" autoIncrement="true" />
     <column name="nomevaluateur" type="varchar" size="50" />
     <column name="prenomevaluateur" type="varchar" size="30" />
     <column name="societeevaluateur" type="varchar" size="30" />
     <column name="mailevaluateur" type="varchar" size="70" />
     <column name="telephoneevaluateur" type="varchar" size="30" />
     <column name="inscriptionevaluateur" type="timestamp" />
   </table>

   <table name="categorie" phpName="Categorie">
     <column name="idcategorie" type="integer" required="true" primaryKey="true" autoIncrement="true" />
     <column name="nomecategorie" type="varchar" size="50" />
   </table>
   
 
 </database>


Moreover Object Model Build & Database Build are ok....
Can you solve and explain my mistake plz ?

Thanks in advance,
Best regards.
Capgemini - Oss Partner Team Member - Marseille France
www.osspartner.com
Balth
Member
 
Posts: 50
Joined: Fri Nov 09, 2007 4:06 pm
Location: France

Re: [Askeet Day 2] symfony propel-generate-crud problem

by halfer » Thu Nov 15, 2007 5:45 pm

At your command line, type "php -v". I suspect it will indicate you are executing version 4.x, which won't work. You need to arrange the command "php" to run version 5, preferably >=5.2 if you can.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: [Askeet Day 2] symfony propel-generate-crud problem

by Balth » Thu Nov 15, 2007 6:40 pm

Thanks for help but I run php5 :

Code: Select all
php -v
PHP 5.1.2 (cli) (built: Jul 17 2007 17:32:48)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Capgemini - Oss Partner Team Member - Marseille France
www.osspartner.com
Balth
Member
 
Posts: 50
Joined: Fri Nov 09, 2007 4:06 pm
Location: France

Re: [Askeet Day 2] symfony propel-generate-crud problem

by halfer » Thu Nov 15, 2007 7:05 pm

OK, try validating the XML schema? The easiest way to do this is to load it into a browser, most of them let you know if there are errors in it.

Also, can you chop lines 612-632 of the problem file and post them here, inside [php] tags? That should give some clues.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: [Askeet Day 2] symfony propel-generate-crud problem

by Balth » Fri Nov 16, 2007 11:02 am

Hello,
the xml schema is ok for FF and IE.


Ther are lines : 602 to 640
Code: Select all
public function getEvals($criteria = null, $con = null)
   {
            include_once 'lib/model/om/BaseEvalPeer.php';
      if ($criteria === null) {
         $criteria = new Criteria();
      }
      elseif ($criteria instanceof Criteria)
      {
         $criteria = clone $criteria;
      }

      if ($this->collEvals === null) {
         if ($this->isNew()) {
            $this->collEvals = array();
         } else {

            $criteria->add(EvalPeer::IDEVALUATEUR, $this->getIdevaluateur());

            EvalPeer::addSelectColumns($criteria);
            $this->collEvals = EvalPeer::doSelect($criteria, $con);//HERE IS LINE 622
         }
      } else {
                  if (!$this->isNew()) {
                                    

            $criteria->add(EvalPeer::IDEVALUATEUR, $this->getIdevaluateur());

            EvalPeer::addSelectColumns($criteria);
            if (!isset($this->lastEvalCriteria) || !$this->lastEvalCriteria->equals($criteria)) {
               $this->collEvals = EvalPeer::doSelect($criteria, $con);
            }
         }
      }
      $this->lastEvalCriteria = $criteria;
      return $this->collEvals;
   }


Thanks in advance for your help.

-------------------------------------------------
-------------------------------------------------
-------------------------------------------------

EDIT :

I have a matter with my schema.xml.
Code: Select all
[PHP Error] DOMDocument::schemaValidate(): Element 'database', attribute 'noxsd': The attribute 'noxsd' is not allowed. [line 435 of /usr/share/php/symfony/vendor/propel-generator/classes/propel/phing/AbstractPropelDataModelTask.php]
Execution of target "om-template" failed for the following reason: /usr/share/php/symfony/vendor/propel-generator/build-propel.xml:470:1: XML schema file (/var/www/my_project/config/schema-transformed.xml) does not validate.  See warnings above for reasons validation failed (make sure error_reporting is set to show E_WARNING if you don't see any).
[phingcall] /usr/share/php/symfony/vendor/propel-generator/build-propel.xml:470:1: XML schema file (/var/www/my_project/config/schema-transformed.xml) does not validate.  See warnings above for reasons validation failed (make sure error_reporting is set to show E_WARNING if you don't see any).


And I don't know why because schema.xml is based on the one in askeet day n°2...
Capgemini - Oss Partner Team Member - Marseille France
www.osspartner.com
Balth
Member
 
Posts: 50
Joined: Fri Nov 09, 2007 4:06 pm
Location: France

Re: [Askeet Day 2] symfony propel-generate-crud problem

by Balth » Thu Nov 22, 2007 10:42 am

Solved but I don't know why...
Capgemini - Oss Partner Team Member - Marseille France
www.osspartner.com
Balth
Member
 
Posts: 50
Joined: Fri Nov 09, 2007 4:06 pm
Location: France

Re: [Askeet Day 2] symfony propel-generate-crud problem

by symfunky » Tue Mar 25, 2008 9:19 am

I'm getting the same error on both WAMP on Windows and in Linux. What is going on?

The schema file does not give me any errors when I load it in firefox.

Here is what the w3.org XML validator says when I load the file generated-schema-transformed.xml:

------------------------------------------------------
Schema validating with XSV 3.1-1 of 2007/12/11 16:20:05

* Target: file:/usr/local/XSV/xsvlog/tmpAxSo8Wuploaded
(Real name: generated-schema-transformed.xml)
* docElt: {None}database
* No declaration for document root found, validation was lax
* The schema(s) used for schema-validation had
no errors
* No schema-validity problems were found in the target
------------------------------------------------------

Here are my errors when I run symfony propel-build-model:

propel > om-template:
[propel-om] Target database type: mysql
[propel-om] Target package:
[propel-om] Using template path: /usr/share/php/symfony/vendor/propel-generator/templates
[propel-om] Output directory: /home/me/Desktop/myapp/classes
[propel-om] Processing: generated-schema.xml
[PHP Error] DOMDocument::schemaValidate(): Element 'database', attribute 'noXsd': The attribute 'noXsd' is not allowed. [line 435 of /usr/share/php/symfony/vendor/propel-generator/classes/prope l/phing/AbstractPropelDataModelTask.php]
Execution of target "om-template" failed for the following reason: /usr/share/php/symfony/vendor/propel-generator/build-propel. xml:470:1: XML schema file (/home/me/Desktop/myapp/config/generated-schema-transformed. xml) does not validate. See warnings above for reasons validation failed (make sure error_reporting is set to show E_WARNING if you don't see any).
[phingcall] /usr/share/php/symfony/vendor/propel-generator/build-propel. xml:470:1: XML schema file (/home/me/Desktop/myapp/config/generated-schema-transformed. xml) does not validate. See warnings above for reasons validation failed (make sure error_reporting is set to show E_WARNING if you don't see any).
symfunky
Junior Member
 
Posts: 19
Joined: Wed Mar 05, 2008 4:22 am

Re: [Askeet Day 2] symfony propel-generate-crud problem

by mariusbutuc » Tue Sep 30, 2008 10:02 am

symfunky wrote: [propel-om] Processing: generated-schema.xml
[PHP Error] DOMDocument::schemaValidate(): Element 'database', attribute 'noXsd': The attribute 'noXsd' is not allowed. [line 435 of /usr/share/php/symfony/vendor/propel-generator/classes/prope l/phing/AbstractPropelDataModelTask.php]
Execution of target "om-template" failed for the following reason: /usr/share/php/symfony/vendor/propel-generator/build-propel. xml:470:1: XML schema file (/home/me/Desktop/myapp/config/generated-schema-transformed. xml) does not validate. See warnings above for reasons validation failed (make sure error_reporting is set to show E_WARNING if you don't see any).
[phingcall] /usr/share/php/symfony/vendor/propel-generator/build-propel. xml:470:1: XML schema file (/home/me/Desktop/myapp/config/generated-schema-transformed. xml) does not validate. See warnings above for reasons validation failed (make sure error_reporting is set to show E_WARNING if you don't see any).


symfunky, did you find a solution in the end?
Does anyone have any idea about how to solve this?
mariusbutuc
Junior Member
 
Posts: 6
Joined: Tue Sep 30, 2008 9:07 am
Location: Iasi, RO

Re: [Askeet Day 2] symfony propel-generate-crud problem

by letbeserious » Thu Oct 09, 2008 1:49 pm

Hey guys,

got same problem, solved by disabling that validator

What I did:

- Went to AbstractPropelDataModelTask.php file (see you error for full path)
- Line 457-462 comment that part of code or go to line 112
find protected $validate; and set it to false, that will disable validation execution.


did anyone find other ways to fix?
letbeserious
Senior Member
 
Posts: 116
Joined: Sun May 13, 2007 3:17 pm

Re: [Askeet Day 2] symfony propel-generate-crud problem

by mariusbutuc » Thu Oct 09, 2008 10:13 pm

letbeserious wrote: did anyone find other ways to fix?


In the end I found out that askeet is made with/for symfony v1.0. So I uninstalled v1.1 and then I've explicitly v1.0; that's how I solved this problem and others.
mariusbutuc
Junior Member
 
Posts: 6
Joined: Tue Sep 30, 2008 9:07 am
Location: Iasi, RO