У меня есть эта схема:
shop_products:
_attributes: { phpName: ShopProduct }
products_id: { phpName: Id, type: INTEGER, size: '11', primaryKey: true, autoIncrement: true, required: true }
products_quantity: { phpName: Quantity, type: INTEGER, size: '4', required: true }
products_model: { phpName: Model, type: VARCHAR, size: '12', required: false }
products_image: { phpName: Image, type: VARCHAR, size: '64', required: false }
products_price: { phpName: Price, type: DECIMAL, size: '15', scale: '4', required: false, defaultValue: '0.0000' }
products_date_added: { phpName: DateAdded, type: TIMESTAMP, required: true }
products_last_modified: { phpName: LastModified, type: TIMESTAMP, required: false }
products_date_available: { phpName: DateAvailable, type: TIMESTAMP, required: false }
products_weight: { phpName: Weight, type: DECIMAL, size: '5', scale: '2', required: true }
products_carati: { phpName: Carati, type: FLOAT, required: false, defaultValue: '1' }
products_status: { phpName: Status, type: TINYINT, size: '1', required: true }
manufacturers_id: { phpName: ManufacturerId, type: INTEGER, size: '11', required: false, foreignTable: shop_manufacturers, foreignReference: manufacturers_id, onDelete: SETNULL }
products_ordered: { phpName: Ordered, type: INTEGER, size: '11', required: true, defaultValue: '0' }
shop_categories:
_attributes: { phpName: ShopCategory }
categories_id: { phpName: Id, type: INTEGER, size: '11', primaryKey: true, autoIncrement: true, required: true }
categories_image: { phpName: Image, type: VARCHAR, size: '64', required: false }
parent_id: { phpName: ParentId, type: INTEGER, size: '11', required: true, defaultValue: '0', foreignTable: shop_categories, foreignReference: categories_id, onDelete: CASCADE, onUpdate: CASCADE }
sort_order: { phpName: SortOrder, type: INTEGER, size: '3', required: false }
date_added: { phpName: DateAdded, type: TIMESTAMP, required: false }
last_modified: { phpName: LastModified, type: TIMESTAMP, required: false }
shop_categories_description:
_attributes: { phpName: ShopCategoryDescription }
categories_id: { phpName: CategoryId, type: INTEGER, size: '11', primaryKey: true, required: true, defaultValue: '0', foreignTable: shop_categories, foreignReference: categories_id, onDelete: CASCADE, onUpdate: CASCADE }
language_id: { phpName: LanguageId, type: INTEGER, size: '11', primaryKey: true, required: true, defaultValue: '1', foreignTable: culture, foreignReference: id, onDelete: CASCADE, onUpdate: CASCADE }
categories_name: { phpName: Name, type: VARCHAR, size: '32', required: true }
Затем я создал модуль администратора из модели ShopProducts, но когда я пытаюсь перейти к нему, он говорит:
Класс "ShopCategory" должен реализовывать метод "__toString", который будет отображаться в виджете "sfWidgetFormPropelChoice"
Как видите, модель, в которой находятся названия категорий, - это ShopCategoriesDescription.Итак, как я могу получить название категории из класса модели ShopCategory?
Хавьер
sf 1.4 / propel