From: Gustavo Martin Morcuende Date: Wed, 30 May 2012 22:00:32 +0000 (+0200) Subject: Ads with GPS coordinates and logo in companies. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=49bb1f117f291ffc4c85a3deb1debd7e5377a075;p=mobi%2F.git Ads with GPS coordinates and logo in companies. --- diff --git a/apps/companyfront/modules/company/templates/indexSuccess.php b/apps/companyfront/modules/company/templates/indexSuccess.php index 6db6761..0b486c1 100644 --- a/apps/companyfront/modules/company/templates/indexSuccess.php +++ b/apps/companyfront/modules/company/templates/indexSuccess.php @@ -3,18 +3,20 @@ - + + - + + diff --git a/apps/userfront/modules/api/actions/actions.class.php b/apps/userfront/modules/api/actions/actions.class.php index f3b93d6..06e3db8 100644 --- a/apps/userfront/modules/api/actions/actions.class.php +++ b/apps/userfront/modules/api/actions/actions.class.php @@ -49,7 +49,7 @@ class apiActions extends sfActions //If there are not results. //In production replace this line by a die command (trying to stop wasting TCP bandwidth) throw new sfError404Exception(sprintf(' - There are not offices with GPS coordinates: longitude "%s" and + There are not offices or ads with GPS coordinates: longitude "%s" and latitude "%s".', $request->getParameter('longitude'), $request->getParameter('latitude'))); //die; } diff --git a/config/doctrine/schema.yml b/config/doctrine/schema.yml index 9380aba..3c65a6f 100644 --- a/config/doctrine/schema.yml +++ b/config/doctrine/schema.yml @@ -5,9 +5,11 @@ # Company: + actAs: [Timestampable] columns: user_id: { type: integer (4), notnull: true } company_cif: { type: string(255), notnull: true, unique: true } + company_logo: { type: string(255), notnull: true } relations: User: { class: sfGuardUser, local: user_id, onDelete: CASCADE } @@ -103,6 +105,7 @@ Ad: columns: company_id: { type: integer, notnull: true } company_categ_id: { type: integer } + ad_gps: { type: blob } ad_mobile_image_link: { type: string (3000), notnull: true } relations: Company: { onDelete: CASCADE, local: company_id, foreign: id } diff --git a/data/fixtures/fixtures.yml b/data/fixtures/fixtures.yml index 14a966b..1a0e20d 100644 --- a/data/fixtures/fixtures.yml +++ b/data/fixtures/fixtures.yml @@ -74,13 +74,16 @@ Company: MOBILEADVERTISING: User: MOBILEADVERTISING company_cif: 4683838383-I + company_logo: mobileads.jpg DIA: User: DIA company_cif: 5748934949-K + company_logo: dia.jpg CARREFOUR: User: CARREFOUR company_cif: 0390390309-L - + company_logo: carrefour.jpg + Office: DIA_Mostoles: Company: DIA @@ -175,15 +178,15 @@ Ad: BabuchasVerdes: Company: CARREFOUR CompanyCategory: CompanyCategory_2 - ad_mobile_image_link: http://gumartinm.name/vickie.gif + ad_mobile_image_link: babuchasverdes.jpg BabuchasVerdisimas: Company: CARREFOUR CompanyCategory: CompanyCategory_2 - ad_mobile_image_link: http://gumartinm.name/vickie.gif + ad_mobile_image_link: babuchasverdisimas.jpg Donuts: Company: CARREFOUR CompanyCategory: CompanyCategory_3 - ad_mobile_image_link: http://gumartinm.name/vickie.gif + ad_mobile_image_link: donuts.jpg AdDescription: diff --git a/data/sql/schema.sql b/data/sql/schema.sql index 64901b1..f83f2e5 100644 --- a/data/sql/schema.sql +++ b/data/sql/schema.sql @@ -1,7 +1,7 @@ -CREATE TABLE ad (id BIGSERIAL, company_id BIGINT NOT NULL, company_categ_id BIGINT, ad_mobile_image_link VARCHAR(3000) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY(id)); +CREATE TABLE ad (id BIGSERIAL, company_id BIGINT NOT NULL, company_categ_id BIGINT, ad_gps BYTEA, ad_mobile_image_link VARCHAR(3000) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY(id)); CREATE TABLE ad_description (id BIGSERIAL, language_id BIGINT NOT NULL, ad_id BIGINT NOT NULL, ad_name VARCHAR(255) NOT NULL, ad_description text, ad_mobile_text VARCHAR(500) NOT NULL, ad_link VARCHAR(3000) NOT NULL, PRIMARY KEY(id)); CREATE TABLE city (id BIGSERIAL, city_name VARCHAR(64) NOT NULL, region_id BIGINT NOT NULL, PRIMARY KEY(id)); -CREATE TABLE company (id BIGSERIAL, user_id INT NOT NULL, company_cif VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY(id)); +CREATE TABLE company (id BIGSERIAL, user_id INT NOT NULL, company_cif VARCHAR(255) NOT NULL UNIQUE, company_logo VARCHAR(255) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, PRIMARY KEY(id)); CREATE TABLE company_category (id BIGSERIAL, company_id BIGINT NOT NULL, general_categ_id BIGINT, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, root_id BIGINT, lft INT, rgt INT, level SMALLINT, PRIMARY KEY(id)); CREATE TABLE company_category_description (id BIGSERIAL, language_id BIGINT NOT NULL, company_categ_id BIGINT NOT NULL, company_categ_name VARCHAR(255) NOT NULL, company_categ_description text, PRIMARY KEY(id)); CREATE TABLE company_description (id BIGSERIAL, company_id BIGINT NOT NULL, language_id BIGINT NOT NULL, company_name VARCHAR(255) NOT NULL, PRIMARY KEY(id)); diff --git a/lib/filter/doctrine/base/BaseAdFormFilter.class.php b/lib/filter/doctrine/base/BaseAdFormFilter.class.php index 6c9190d..09d1b1b 100644 --- a/lib/filter/doctrine/base/BaseAdFormFilter.class.php +++ b/lib/filter/doctrine/base/BaseAdFormFilter.class.php @@ -15,6 +15,7 @@ abstract class BaseAdFormFilter extends BaseFormFilterDoctrine $this->setWidgets(array( 'company_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Company'), 'add_empty' => true)), 'company_categ_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CompanyCategory'), 'add_empty' => true)), + 'ad_gps' => new sfWidgetFormFilterInput(), 'ad_mobile_image_link' => new sfWidgetFormFilterInput(array('with_empty' => false)), 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), @@ -23,6 +24,7 @@ abstract class BaseAdFormFilter extends BaseFormFilterDoctrine $this->setValidators(array( 'company_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Company'), 'column' => 'id')), 'company_categ_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CompanyCategory'), 'column' => 'id')), + 'ad_gps' => new sfValidatorPass(array('required' => false)), 'ad_mobile_image_link' => new sfValidatorPass(array('required' => false)), 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), @@ -48,6 +50,7 @@ abstract class BaseAdFormFilter extends BaseFormFilterDoctrine 'id' => 'Number', 'company_id' => 'ForeignKey', 'company_categ_id' => 'ForeignKey', + 'ad_gps' => 'Text', 'ad_mobile_image_link' => 'Text', 'created_at' => 'Date', 'updated_at' => 'Date', diff --git a/lib/filter/doctrine/base/BaseCompanyFormFilter.class.php b/lib/filter/doctrine/base/BaseCompanyFormFilter.class.php index 237524b..b4a841b 100644 --- a/lib/filter/doctrine/base/BaseCompanyFormFilter.class.php +++ b/lib/filter/doctrine/base/BaseCompanyFormFilter.class.php @@ -13,13 +13,19 @@ abstract class BaseCompanyFormFilter extends BaseFormFilterDoctrine public function setup() { $this->setWidgets(array( - 'user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)), - 'company_cif' => new sfWidgetFormFilterInput(array('with_empty' => false)), + 'user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)), + 'company_cif' => new sfWidgetFormFilterInput(array('with_empty' => false)), + 'company_logo' => new sfWidgetFormFilterInput(array('with_empty' => false)), + 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), + 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), )); $this->setValidators(array( - 'user_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id')), - 'company_cif' => new sfValidatorPass(array('required' => false)), + 'user_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id')), + 'company_cif' => new sfValidatorPass(array('required' => false)), + 'company_logo' => new sfValidatorPass(array('required' => false)), + 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), + 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), )); $this->widgetSchema->setNameFormat('company_filters[%s]'); @@ -39,9 +45,12 @@ abstract class BaseCompanyFormFilter extends BaseFormFilterDoctrine public function getFields() { return array( - 'id' => 'Number', - 'user_id' => 'ForeignKey', - 'company_cif' => 'Text', + 'id' => 'Number', + 'user_id' => 'ForeignKey', + 'company_cif' => 'Text', + 'company_logo' => 'Text', + 'created_at' => 'Date', + 'updated_at' => 'Date', ); } } diff --git a/lib/form/doctrine/AdForm.class.php b/lib/form/doctrine/AdForm.class.php index 510622a..5d8879c 100644 --- a/lib/form/doctrine/AdForm.class.php +++ b/lib/form/doctrine/AdForm.class.php @@ -46,10 +46,36 @@ class AdForm extends BaseAdForm 'min_width' => 128, 'mime_types' => array('image/jpeg','image/pjpeg','image/png','image/x-png','image/gif','application/x-shockwave-flash'))); + $this->widgetSchema['longitude'] = new sfWidgetFormInputFloat(); + $this->widgetSchema['latitude'] = new sfWidgetFormInputFloat(); + + + $this->validatorSchema['longitude'] = new sfValidatorNumber(array('max' => 180, + 'min' => -180, + 'required' => false, + 'trim' => true), + array('invalid' => 'Wrong Longitude', + 'max' => 'Longitude "%value%" must not exceed the %max% value', + 'min' => 'Longitude "%value%" must be equal or higher than %min%')); + + + + $this->validatorSchema['latitude'] = new sfValidatorNumber(array('max' => 90, + 'min' => -90, + 'required' => false, + 'trim' => true), + array('invalid' => 'Wrong Latitude', + 'max' => 'Latitude "%value%" must not exceed the %max% value', + 'min' => 'Latitude "%value%" must be equal or higher than %min%')); + + $this->widgetSchema->setLabels(array('company_categ_id' => 'Company Category')); $this->widgetSchema->setLabels(array('ad_mobile_image_link' => "Picture on the user's mobile")); + $this->widgetSchema->setLabels(array('longitude' => 'Longitude (180 to -180): ')); + $this->widgetSchema->setLabels(array('latitude' => 'Latitude (90 to -90): ')); + //i18n (Internationalization) @@ -143,4 +169,43 @@ class AdForm extends BaseAdForm } } } + + /** + * Overriding updateDefaultsFromObject method from lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php + * + * TODO: create a Doctrine_Record for PostGIS + */ + protected function updateDefaultsFromObject() + { + parent::updateDefaultsFromObject(); + + $this->setDefault('longitude', $this->getObject()->getLongitude()); + $this->setDefault('latitude', $this->getObject()->getLatitude()); + } + + /** + * Overriding doSave method from lib/vendor/symfony/lib/form/addon/sfFormObject.class.php + * + * We are updating the data base in just 1 transaction + * In case of unsetting longitude or latitude fields you will have to override this method. + * TODO: create a Doctrine_Record for PostGIS + */ + protected function doSave($con = null) + { + parent::doSave($con); + + //Get latitude and longitude values. They will be translated to GEOGRAPHIC data. + foreach ($this->values as $field => $value) + { + if ($field == 'longitude') + $longitude = $value; + if ($field == 'latitude') + $latitude = $value; + } + //Catch id element. We will use this id to insert the PostGIS value in the right row. + $arrowId = $this->getObject()->getId(); + //Update PostGIS + //This connection will throw exception in case of error. + Doctrine_Manager::connection()->execute("UPDATE ad SET ad_gps=ST_GeographyFromText('SRID=4326;POINT($longitude $latitude)') WHERE id=$arrowId"); + } } diff --git a/lib/form/doctrine/CompanyForm.class.php b/lib/form/doctrine/CompanyForm.class.php index 89a32c3..e2081fc 100644 --- a/lib/form/doctrine/CompanyForm.class.php +++ b/lib/form/doctrine/CompanyForm.class.php @@ -18,7 +18,27 @@ class CompanyForm extends BaseCompanyForm $this->useFields(array('company_cif')); + $this->widgetSchema['company_logo'] = + new sfWidgetFormInputFileEditable(array('file_src' => '/uploads/images/'.$this->getObject()->company_logo, + 'edit_mode' => !$this->isNew(), + 'is_image' => true, + 'with_delete' => false)); + + + $this->validatorSchema['company_logo'] = new sfValidatorFileImage(array('mime_types' => 'web_images', + 'path' => sfConfig::get('app_default_picture_directory'), + 'required' => $this->isNew(), + 'is_only_image' => true, + 'max_height' => 150, + 'min_height' => 128, + 'max_width' => 150, + 'min_width' => 128, + 'mime_types' => array('image/jpeg','image/pjpeg','image/png','image/x-png','image/gif','application/x-shockwave-flash'))); + + + $this->widgetSchema->setLabels(array('company_cif' => 'CIF: ')); + $this->widgetSchema->setLabels(array('company_logo' => "Your company logo: ")); //Company create new description form diff --git a/lib/form/doctrine/base/BaseAdForm.class.php b/lib/form/doctrine/base/BaseAdForm.class.php index a70a53e..28c6c2a 100644 --- a/lib/form/doctrine/base/BaseAdForm.class.php +++ b/lib/form/doctrine/base/BaseAdForm.class.php @@ -18,6 +18,7 @@ abstract class BaseAdForm extends BaseFormDoctrine 'id' => new sfWidgetFormInputHidden(), 'company_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Company'), 'add_empty' => false)), 'company_categ_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CompanyCategory'), 'add_empty' => true)), + 'ad_gps' => new sfWidgetFormTextarea(), 'ad_mobile_image_link' => new sfWidgetFormTextarea(), 'created_at' => new sfWidgetFormDateTime(), 'updated_at' => new sfWidgetFormDateTime(), @@ -27,6 +28,7 @@ abstract class BaseAdForm extends BaseFormDoctrine 'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)), 'company_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Company'))), 'company_categ_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CompanyCategory'), 'required' => false)), + 'ad_gps' => new sfValidatorString(array('required' => false)), 'ad_mobile_image_link' => new sfValidatorString(array('max_length' => 3000)), 'created_at' => new sfValidatorDateTime(), 'updated_at' => new sfValidatorDateTime(), diff --git a/lib/form/doctrine/base/BaseCompanyForm.class.php b/lib/form/doctrine/base/BaseCompanyForm.class.php index 6359499..f0ebdbf 100644 --- a/lib/form/doctrine/base/BaseCompanyForm.class.php +++ b/lib/form/doctrine/base/BaseCompanyForm.class.php @@ -15,15 +15,21 @@ abstract class BaseCompanyForm extends BaseFormDoctrine public function setup() { $this->setWidgets(array( - 'id' => new sfWidgetFormInputHidden(), - 'user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)), - 'company_cif' => new sfWidgetFormInputText(), + 'id' => new sfWidgetFormInputHidden(), + 'user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)), + 'company_cif' => new sfWidgetFormInputText(), + 'company_logo' => new sfWidgetFormInputText(), + 'created_at' => new sfWidgetFormDateTime(), + 'updated_at' => new sfWidgetFormDateTime(), )); $this->setValidators(array( - 'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)), - 'user_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))), - 'company_cif' => new sfValidatorString(array('max_length' => 255)), + 'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)), + 'user_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))), + 'company_cif' => new sfValidatorString(array('max_length' => 255)), + 'company_logo' => new sfValidatorString(array('max_length' => 255)), + 'created_at' => new sfValidatorDateTime(), + 'updated_at' => new sfValidatorDateTime(), )); $this->validatorSchema->setPostValidator( diff --git a/lib/model/doctrine/Ad.class.php b/lib/model/doctrine/Ad.class.php index 8a9351e..c717bcb 100644 --- a/lib/model/doctrine/Ad.class.php +++ b/lib/model/doctrine/Ad.class.php @@ -47,4 +47,35 @@ class Ad extends BaseAd //Finally, if nothing was found, return nice error message. return (string) "Ad without default language"; } + + public function getGpsST_AsText() + { + $aux=$this->getAdGps(); + if ($aux) + { + //Using a PostGIS query to convert a GIS value? This is a bit strange + $results=Doctrine_Manager::getInstance()->getCurrentConnection()->fetchColumn("SELECT ST_AsText('$aux')"); + return trim($results['0'], "POINT()"); + } + else + return 0; + } + + public function getLongitude() + { + $gpsST_AsText=$this->getGpsST_AsText(); + + $longitude = strstr($gpsST_AsText, ' ', true); + + return $longitude; + } + + public function getLatitude() + { + $gpsST_AsText=$this->getGpsST_AsText(); + + $latitude = strstr($gpsST_AsText, ' '); + + return $latitude; + } } diff --git a/lib/model/doctrine/AdDescriptionTable.class.php b/lib/model/doctrine/AdDescriptionTable.class.php index 8339438..a3bc0e5 100644 --- a/lib/model/doctrine/AdDescriptionTable.class.php +++ b/lib/model/doctrine/AdDescriptionTable.class.php @@ -47,7 +47,7 @@ class AdDescriptionTable extends Doctrine_Table try{ $adIds = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchColumn( - "SELECT ad_id from office INNER JOIN office_ads ON (office_ads.office_id=office.id) + "SELECT ad_id FROM office INNER JOIN office_ads ON (office_ads.office_id=office.id) WHERE ST_DWithin(office_gps, ST_GeographyFromText('SRID=4326;POINT($longitude $latitude)'), $radius)" ); } @@ -56,13 +56,23 @@ class AdDescriptionTable extends Doctrine_Table //In case of error return as soon as posible. return null; } - if (empty($adIds)) + try{ + $directAdIds = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchColumn( + "SELECT id FROM ad WHERE ST_DWithin(ad_gps, ST_GeographyFromText('SRID=4326;POINT($longitude $latitude)'), $radius)" + ); + } + catch (Exception $e) + { + //In case of error return as soon as posible. + return null; + } + if (empty($adIds) && empty($directAdIds)) { //There are not offices with those GPS coordinates. //In many situations we will get this result, so a fast response. return null; } - - $uniqAdIds = array_unique($adIds, SORT_NUMERIC); + $arrayMerge = array_merge($adIds, $directAdIds); + $uniqAdIds = array_unique($arrayMerge, SORT_NUMERIC); //We can not waste time doing this query. What is the best way to achieve this goal? //Is a direct query the best way? With big tables I think this is not going to work. diff --git a/lib/model/doctrine/base/BaseAd.class.php b/lib/model/doctrine/base/BaseAd.class.php index 7d6276a..a8c9d91 100644 --- a/lib/model/doctrine/base/BaseAd.class.php +++ b/lib/model/doctrine/base/BaseAd.class.php @@ -7,6 +7,7 @@ * * @property integer $company_id * @property integer $company_categ_id + * @property blob $ad_gps * @property string $ad_mobile_image_link * @property Company $Company * @property CompanyCategory $CompanyCategory @@ -15,6 +16,7 @@ * * @method integer getCompanyId() Returns the current record's "company_id" value * @method integer getCompanyCategId() Returns the current record's "company_categ_id" value + * @method blob getAdGps() Returns the current record's "ad_gps" value * @method string getAdMobileImageLink() Returns the current record's "ad_mobile_image_link" value * @method Company getCompany() Returns the current record's "Company" value * @method CompanyCategory getCompanyCategory() Returns the current record's "CompanyCategory" value @@ -22,6 +24,7 @@ * @method Doctrine_Collection getOfficeAds() Returns the current record's "OfficeAds" collection * @method Ad setCompanyId() Sets the current record's "company_id" value * @method Ad setCompanyCategId() Sets the current record's "company_categ_id" value + * @method Ad setAdGps() Sets the current record's "ad_gps" value * @method Ad setAdMobileImageLink() Sets the current record's "ad_mobile_image_link" value * @method Ad setCompany() Sets the current record's "Company" value * @method Ad setCompanyCategory() Sets the current record's "CompanyCategory" value @@ -45,6 +48,9 @@ abstract class BaseAd extends sfDoctrineRecord $this->hasColumn('company_categ_id', 'integer', null, array( 'type' => 'integer', )); + $this->hasColumn('ad_gps', 'blob', null, array( + 'type' => 'blob', + )); $this->hasColumn('ad_mobile_image_link', 'string', 3000, array( 'type' => 'string', 'notnull' => true, diff --git a/lib/model/doctrine/base/BaseCompany.class.php b/lib/model/doctrine/base/BaseCompany.class.php index 7e04772..8582025 100644 --- a/lib/model/doctrine/base/BaseCompany.class.php +++ b/lib/model/doctrine/base/BaseCompany.class.php @@ -7,6 +7,7 @@ * * @property integer $user_id * @property string $company_cif + * @property string $company_logo * @property sfGuardUser $User * @property Doctrine_Collection $CompanyDescription * @property Doctrine_Collection $Office @@ -15,6 +16,7 @@ * * @method integer getUserId() Returns the current record's "user_id" value * @method string getCompanyCif() Returns the current record's "company_cif" value + * @method string getCompanyLogo() Returns the current record's "company_logo" value * @method sfGuardUser getUser() Returns the current record's "User" value * @method Doctrine_Collection getCompanyDescription() Returns the current record's "CompanyDescription" collection * @method Doctrine_Collection getOffice() Returns the current record's "Office" collection @@ -22,6 +24,7 @@ * @method Doctrine_Collection getAd() Returns the current record's "Ad" collection * @method Company setUserId() Sets the current record's "user_id" value * @method Company setCompanyCif() Sets the current record's "company_cif" value + * @method Company setCompanyLogo() Sets the current record's "company_logo" value * @method Company setUser() Sets the current record's "User" value * @method Company setCompanyDescription() Sets the current record's "CompanyDescription" collection * @method Company setOffice() Sets the current record's "Office" collection @@ -49,6 +52,11 @@ abstract class BaseCompany extends sfDoctrineRecord 'unique' => true, 'length' => 255, )); + $this->hasColumn('company_logo', 'string', 255, array( + 'type' => 'string', + 'notnull' => true, + 'length' => 255, + )); } public function setUp() @@ -74,5 +82,9 @@ abstract class BaseCompany extends sfDoctrineRecord $this->hasMany('Ad', array( 'local' => 'id', 'foreign' => 'company_id')); + + $timestampable0 = new Doctrine_Template_Timestampable(array( + )); + $this->actAs($timestampable0); } } \ No newline at end of file
 
getCompany()->getCompanyLogo() ?>" width="100" height="100"/> getCompanyName() ?> getCompany()->getCompanyCif() ?>