No subject


Fri Mar 12 13:03:17 CET 2010


shortDescription in any case and not short_description.

       public function setShortDescription($short_description) {
               $this->short_description =3D $short_description;
       }

should be

       public function setShortDescription($shortDescription) {
               $this->shortDescription =3D $shortDescription;
       }

I guess it's not needed for the argument, but just to keep code clean :)

The same for you getter methods

Regards,

S=F8ren

On Tue, Apr 20, 2010 at 12:27 PM, Daniel Dimitrov <danielsd_bg at yahoo.fr> wr=
ote:
> Hey guys,
> I'm trying to figure something out, but so far I'm unsuccessful :(
> I have a simple Model class:
> /**
> * A product
> *
> * @version $id:$
> * @scope prototype
> * @entity
> */
> class Tx_Bwshop_Domain_Model_Products extends
> Tx_Extbase_DomainObject_AbstractEntity {
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * the product's title
> =A0 =A0 =A0 =A0 * @var string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0protected $title;
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * the product's author_name
> =A0 =A0 =A0 =A0 * @var string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0protected $author_name;
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * the product's description
> =A0 =A0 =A0 =A0 * @var string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0protected $description;
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * the product's short description
> =A0 =A0 =A0 =A0 * @var string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0protected $short_description;
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * the product's volume
> =A0 =A0 =A0 =A0 * @var string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0protected $volume;
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * get the product's title
> =A0 =A0 =A0 =A0 * @return string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0public function getTitle() {
> // =A0 =A0 =A0 =A0 =A0 =A0 =A0var_dump($this);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return $this->title;
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * get the product's short_description
> =A0 =A0 =A0 =A0 * @return string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0public function getShortDescription() {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return $this->short_description;
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * get the product's author_name
> =A0 =A0 =A0 =A0 * @return string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0public function getAuthorName() {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return $this->author_name;
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * get the product's title
> =A0 =A0 =A0 =A0 * @return string
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0public function getDescription() {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return $this->description;
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * Sets the title of the product
> =A0 =A0 =A0 =A0 *
> =A0 =A0 =A0 =A0 * @param string $title of the product
> =A0 =A0 =A0 =A0 * @return void;
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0public function setTitle($title) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$this->title =3D $title;
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * Sets the author_name of the product
> =A0 =A0 =A0 =A0 *
> =A0 =A0 =A0 =A0 * @param string $author_name of the product
> =A0 =A0 =A0 =A0 * @return void;
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0public function setAuthorName($author_name) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$this->author_name =3D $author_name;
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0/**
> =A0 =A0 =A0 =A0 * Sets the short_description of the product
> =A0 =A0 =A0 =A0 *
> =A0 =A0 =A0 =A0 * @param string $title of the product
> =A0 =A0 =A0 =A0 * @return void;
> =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0 =A0public function setShortDescription($short_description) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$this->short_description =3D $short_descri=
ption;
> =A0 =A0 =A0 =A0}
> }
>
> when I use findAll to get all data from the database a single object from
> the result looks like this:
> object(Tx_Bwshop_Domain_Model_Products)#107 (8) {
> =A0 ["title:protected"]=3D>
> =A0 string(17) "ABCP"
> =A0 ["author_name:protected"]=3D>
> =A0 NULL
> =A0 ["description:protected"]=3D>
> =A0 string(11) "description"
> =A0 ["short_description:protected"]=3D>
> =A0 NULL
> =A0 ["volume:protected"]=3D>
> =A0 string(3) "100"
> =A0 ["_cleanProperties:private"]=3D>
> =A0 array(4) {
> =A0 =A0 ["title"]=3D>
> =A0 =A0 string(17) "ABCProblemAnalyse"
> =A0 =A0 ["description"]=3D>
> =A0 =A0 string(11) "description"
> =A0 =A0 ["volume"]=3D>
> =A0 =A0 string(3) "100"
> =A0 =A0 ["uid"]=3D>
> =A0 =A0 int(1056)
> =A0 }
> =A0 ["uid:protected"]=3D>
> =A0 int(1056)
> =A0 ["isClone:private"]=3D>
> =A0 bool(false)
> =A0}
>
> as you see the object has proteted properties such as short_description a=
nd
> author_name that are not added to the _cleanProperties.
> Actually, why is the value set to NULL? Author_name and short_description
> are fields in the database and they are defined in my tca.php file like
> this:
> =A0 =A0 =A0 =A0'author_name' =3D> array (
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'exclude' =3D> 0,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'label' =3D>
> 'LLL:EXT:bw_shop/Resources/Private/Language/locallang_db.xml:tx_bwshop_do=
main_model_products.author_name',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'config' =3D> array (
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'type' =3D=
> 'input',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'size' =3D=
> '30',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0),
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'short_description' =3D> array(
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'exclude' =3D> 1,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'label' =A0 =3D>
> 'LLL:EXT:bw_shop/Resources/Private/Language/locallang_db.xml:tx_bwshop_do=
main_model_products.short_description',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'config' =A0=3D> array(
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'type' =3D=
> 'text',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'rows' =3D=
> 5,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'cols' =3D=
> 30,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0),
>
>
> Any ideas what I do wrong?
> Thanks,
> Daniel
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>



--=20
Officially Certified TYPO3 Integrator


More information about the TYPO3-project-typo3v4mvc mailing list