I have a schema where I extend sfGuardGroup to bind it to a "Company" table.
Here's the part of the schema:
Group:
inheritance:
extends: sfGuardGroup
type: simple
columns:
company_id: integer
relations:
Company:
class: Company
local: company_id
foreignAlias: Group
foreignType: one
type: one
Now in my company object, on the save call, I try this:
public function save(Doctrine_Connection $conn = null)
{
parent::save($conn);
$group = $this->getGroup();
// Mapped group update
$mappingPrefix = uniquid();
if (!$group->exists())
{
$group = new Group();
$group->setName($mappingPrefix . $this->getName());
$group->setCompanyId($this->getId());
$group->save();
}
else
{
$group->setName($mappingPrefix . $this->getName());
$group->save();
}
}
I end up with the error in the title:
Unknown record property / related component "name" on "Group"
If I add this to Company:
public function getGroup(){
$result = GroupTable::getInstance()->createQuery('q')
->where('company_id = ?', $this->getId())
->fetchOne();
return $result ? $result : new Group();
}
Everything works again!