2012-04-10 7 views
0

Symfony 1.4에 모듈을 만들었습니다. 그것은 예상대로 작동합니다. 그럼에도 불구하고 dev.php 모드 일 때 구문 오류이 표시됩니다.Symfony 1.4 : dev.php 모드에서 오류가 발생했습니다. 비 dev.php 모드에서 작동

보자 :

http://honeylumpi.mobi/dev.php/panelparameter 
NOTE: panelparameter is the admin-module that I created. 

를 내가 얻을 :

Parse error: syntax error, unexpected T_STRING in /home/lola/hl/honey-lumpi/cache/cms/dev/modules/autoPanelparameter/actions/actions.class.php on line 66 

자, 줄에서 내가 얻을 actions.class.php66 :

Warning: stream_get_contents() expects parameter 1 to be resource, null given in /home/lola/hl/honey-lumpi/lib/model/sitebuilder/PanelParameter.php on line 22 

그리고 라인을 22PanelParameter.php :

/** 
* Returns the serialized value. 
* 
* @return string 
*/ 
public function getSerializedValue() 
{ 
    $res = parent::getValue(); 
    $retval = stream_get_contents($res); <-- This is line 22! 
    rewind($res); 
    return $retval; 
} 

나는 사실, 이다, 에코 와서 덧붙였다. 그러나 나는 왜 그런지 모른다. 그 코드는 Symfony에 의해 자동 생성됩니다. 나는 그 문제를 해결하는 방법을 모른다. 다시 모듈은 정상적으로 작동하지만 dev.php에서 오류가 발생합니다. 나는 캐시 삭제 등

편집 : 나는, 내가 생성 모르는 심포니 웹 사이트를 만들기 위해 sitebuilder을 몰랐다

<?php 

/** 
* Subclass for representing a row from the 'PanelParameter' table. 
* 
* 
* 
* @package lib.model 
*/ 
class PanelParameter extends BasePanelParameter 
{ 
    private $condition; 

/** 
* Returns the serialized value. 
* 
* @return string 
*/ 
public function getSerializedValue() 
{ 
    $res = parent::getValue(); 
    $retval = stream_get_contents($res); 
    rewind($res); 
    return $retval; 
} 

/** 
* Sets the value already serialized. 
* 
* @param string $v 
*/ 
public function setSerializedValue ($v) 
{ 
    parent::setValue($v); 
} 

/** 
* Returns the value of the parameter. 
* 
* @return mixed 
*/ 
public function getValue() 
{ 
    // get serialized value 
    $v = $this->getSerializedValue(); 

    // unserialize 
    $value = @unserialize($v); 

    // check for error 
    if (false === $value) 
    { 
     if ('b:0;' != $v) 
     { 
      if (PHP_VERSION_ID < 50300) 
      { 
       gxLog::a(__CLASS__, "cannot unserialize parameter #{$this->id} {$this->name} value:{$v}"); 
       $value = null; 
      } 
      else 
      { 
       // try to fix array indexes 
       $cb = create_function('$m', 'return "s:".strlen($m[1]).":\"$m[1]\"";'); 
       $v = preg_replace_callback('/i:([0-9]{12,})/', $cb, $v); 
       $value = @unserialize($v); 
       if (false === $value) 
       { 
        gxLog::a(__CLASS__, "cannot unserialize parameter #{$this->id} {$this->name} value:{$v}"); 
        $value = null; 
       } 
      } 
     } 
    } 

    // return unserialized value 
    return $value; 
} 

/** 
* Sets the value for the parameter. 
* 
* @param mixed $v 
*/ 
public function setValue ($v) 
{ 
    $value = @serialize($v); 
    parent::setValue($value); 
} 

/** 
* Returns the name of the parameter. 
* 
* @return string 
*/ 
public function __toString() 
{ 
    return $this->getName(); 
} 

/** 
* Returns the condition object. 
* 
* @return gxSiteCondition 
*/ 
public function getCondition() 
{ 
    if (!isset($this->condition)) 
    { 
     // no condition is true always 
     $condition = new gxSiteCondition; 

     $cond = parent::getCond(); 
     if (!is_null($cond)) 
     { 
      // unserialize 
      $condition = gxSiteCondition::createFromJson($cond); 
     } 

     // store 
     $this->condition = $condition; 
    } 

    return $this->condition; 
} 

/** 
* Sets the condition. 
* 
* @param gxSiteCondition $c 
*/ 
public function setCondition ($c) 
{ 
    if (!($c instanceof gxSiteCondition)) throw new Exception ('parameter is not gxSiteCondition'); 

    // serialize 
    $cond = $c->toJson(); 

    // store 
    $this->condition = $c; 

    // store condition 
    parent::setCond($cond); 
} 

/** 
* Checks the condition in the provided context. 
* 
* @param sfContext $context 
*/ 
public function checkCondition (sfContext $context) 
{ 
    // get condition 
    $condition = $this->getCondition(); 

    // evaluate condition 
    return $condition ? $condition->evaluate($context) : true; 
} 

/** 
* Returns true if the provided condition is contained 
* in this object's condition. 
* 
* @param gxBasicCondition $c 
* @return boolean 
*/ 
public function containsCondition (gxSiteCondition $c) 
{ 
    // get condition 
    $condition = $this->getCondition(); 

    // check if contained condition 
    return $condition ? $condition->contains($c) : true; 
} 

/** 
* Set default value for condition if new and not set. 
* 
* @param PropelPDO $con 
* @return int 
*/ 
public function save (PropelPDO $con = null) 
{ 
    if ($this->isNew() && !$this->isColumnModified(PanelParameterPeer::COND)) 
    { 
     $this->setCondition(new gxSiteCondition); 
    } 

    return parent::save($con); 
} 

/** 
* Sets contents of passed object to values from current object. 
* 
* If desired, this method can also make copies of all associated (fkey referrers) 
* objects. 
* 
* @param  object $copyObj An object of PanelParameter (or compatible) type. 
* @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
* @throws  PropelException 
*/ 
public function copyInto($copyObj, $deepCopy = false) 
{ 

    $copyObj->setName($this->name); 

    $copyObj->setSerializedValue($this->getSerializedValue()); 

    $copyObj->setCond($this->cond); 

    $copyObj->setPanelId($this->panel_id); 

    $copyObj->setNew(true); 

    $copyObj->setId(NULL); // this is a pkey column, so set to default value 

} 
} 
+0

어리석은 질문이지만, 심포니 cc를 수행 했습니까? 그리고'sitebuilder'는 무엇입니까? 귀하의 모델 파일이'doctrine' 대신 (또는 propel 용 모델 폴더에서)'sitebuilder' 폴더 안에 있음을 압니다. – j0k

+0

예, symfony cc와 동일한 결과를 보았습니다. Sitebuilder는 0에서 사이트를 동적으로 생성하는 데 사용됩니다. 나는 그것을 만들지 않았다. ** Symfony1.0 **에서 ** Symfony1.4 **로 일부 코드를 마이그레이션 중입니다. 내가 궁금해하는 점은 ** dev.php없이 ** 작동한다는 것입니다. 나는 프로펠 – Kani

답변

0

: 이것은 /home/lola/hl/honey-lumpi/lib/model/sitebuilder/PanelParameter.php의 모든 코드 이 도구에서.

하지만 모델을 다시 작성하려고 했습니까? ./symfony propel:build --all-classes

sitebuilder/propel에서 생성 된 클래스입니까, 아니면 sf1.0 가져 오기에서 생성 된 클래스입니까?

+0

안녕하세요 사용하고 있습니다. 나는 그 명령과 똑같이했다 : /. 그것은 수입에서 비롯됩니다. 누군가가 코드를 작성했습니다 (또는 그것이 내게 말한 것입니다). 나는 그 파일의 모든 코드로 질문을 갱신 할 것이다! – Kani

+0

저는 이것이'sitebuilder' 또는 응용 프로그램의 목적에 따라 구체적으로 다르지만 symfony 나 propel에서는 그렇지 않다고 생각합니다. 그리고 내가 왜 비 -dex 모드에서 wokring하고 있는지 이해할 수 없습니다. : – j0k

+0

글쎄, 나는'line 22'에서 그랬다 : 'if (isset ($ res)) { $ retval = stream_get_contents ($ res); 되감기 ($ res); return $ retval; } else { return null; }' 그게 문제를 해결했습니다. 이런! – Kani

관련 문제