Mittwoch, 3. September 2008

Symfony - Listen im Admin Generator filtern

Einträge in Selectboxen einer foreignTable filtern (z.B. nach creator):

schema.yml:


propel: project: _attributes: { phpName: Project } id: creator_id: { type: integer, foreignTable: creator foreignReference: id, required: true, onDelete: cascade } name: { type: VARCHAR, size: 255, required: true } description: { type: VARCHAR, size: 255, required: true } ...

/lib/model/ProjectPeer.php:

class ProjectPeer extends BaseProjectPeer { public static function getCreatorfiltered() { $c = new Criteria(); $c->add(ProjectPeer::CREATOR_ID, sfContext::getInstance()->getUser()->getGuardUser()->getId()); //oder Creator ID } return ProjectPeer::doSelect($c); } }
generator.yml:
.. fields: project_id: params: name: Project peer_method: getCreatorfiltered

Keine Kommentare:

Kommentar veröffentlichen