propelorm/Propel — Issue #293: Archiviable don't uses all the required namespaces
Author: alphalemon
Created: 2012-02-14 08:01:17+00:00
State: open

Hello,
I'm trying to use the archivable behavior for my schema, so I've updated it, rebuild the model and inserted the sql. To try it I used the following code:

$content = AlContentQuery::create()->findPk(28);
$newContent = new AlContent();
$values = $content->toArray();
unset($values['Id']);
unset($values['CreatedAt']);
$values['HtmlContent'] = "fake";
$newContent->fromArray($values);
$newContent->save();
$newContent->delete();

So I created a new content from an existing one and saved it but I've got the following error:

PHP Fatal error: Class
'AlphaLemon\AlphaLemonCmsBundle\Model\om\AlContentArchiveQuery' not found
in
/home/laptop/www/alphaLemon/vendor/bundles/AlphaLemon/AlphaLemonCmsBundle/Model/om/BaseAlContent.php
on line 1678

Digging the om created classes, I noticed that this code:

public function getArchive(PropelPDO $con = null)
{
if ($this->isNew()) {
return null;
}
$archive = AlContentArchiveQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->findOne($con);

return $archive;
}

refers to the AlContentArchiveQuery object but there is any

use AlphaLemon\AlphaLemonCmsBundle\Model\AlContentArchiveQuery;

directive (the class is under om). The AlContentArchive is required in another method but is never declared.

use AlphaLemon\AlphaLemonCmsBundle\Model\AlContentArchive;